Linux/linux 8695a53kernel/bpf devmap.c

bpf: devmap fix arithmetic overflow in bitmap_size calculation

An integer overflow is possible in dev_map_bitmap_size() when
calculating the BITS_TO_LONG logic which becomes, after macro
replacement,

        (((n) + (d) - 1)/ (d))

where 'n' is a __u32 and 'd' is (8 * sizeof(long)). To avoid
overflow cast to u64 before arithmetic.

Reported-by: Richard Weinberger <richard at nod.at>
Acked-by: Daniel Borkmann <daniel at iogearbox.net>
Signed-off-by: John Fastabend <john.fastabend at gmail.com>
Acked-by: Alexei Starovoitov <ast at kernel.org>
Signed-off-by: David S. Miller <davem at davemloft.net>
DeltaFile
+1-1kernel/bpf/devmap.c
+1-11 files

UnifiedSplitRaw