]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Fix unused-var without NETDEVICES
authorMatthieu Baerts <matthieu.baerts@tessares.net>
Wed, 3 Jun 2020 19:03:47 +0000 (21:03 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 4 Jun 2020 20:52:10 +0000 (22:52 +0200)
commit9bc46c0821e439d1120da0864541ddb120371ac8
treee768761ed5727d7b628cab70fde6c22aba249328
parent6ce89b8efb8e42eeb3d22257131c6c58d56b158a
bpf: Fix unused-var without NETDEVICES

A recent commit added new variables only used if CONFIG_NETDEVICES is
set. A simple fix would be to only declare these variables if the same
condition is valid but Alexei suggested an even simpler solution:

    since CONFIG_NETDEVICES doesn't change anything in .h I think the
    best is to remove #ifdef CONFIG_NETDEVICES from net/core/filter.c
    and rely on sock_bindtoindex() returning ENOPROTOOPT in the extreme
    case of oddly configured kernels.

Fixes: c5e154642fc5 ("bpf: Allow SO_BINDTODEVICE opt in bpf_setsockopt")
Suggested-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20200603190347.2310320-1-matthieu.baerts@tessares.net
net/core/filter.c