bpf: fix divides by zero
authorEric Dumazet <edumazet@google.com>
Sat, 13 Jan 2018 01:43:23 +0000 (17:43 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 14 Jan 2018 17:03:43 +0000 (09:03 -0800)
commitc366287ebd698ef5e3de300d90cd62ee9ee7373e
treedb24f872f9e1d05b43387b4480914ad8f5ee78b7
parent8155aedf512edd3f88ef19f7cacf476ace7d1322
bpf: fix divides by zero

Divides by zero are not nice, lets avoid them if possible.

Also do_div() seems not needed when dealing with 32bit operands,
but this seems a minor detail.

Fixes: bd4cf0ed331a ("net: filter: rework/optimize internal BPF interpreter's instruction set")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/core.c