]> git.baikalelectronics.ru Git - kernel.git/commit
net, sysctl: Fix compiler warning when only cBPF is present
authorAlexander Lobakin <alobakin@dlink.ru>
Wed, 18 Dec 2019 09:18:21 +0000 (12:18 +0300)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 19 Dec 2019 16:17:51 +0000 (17:17 +0100)
commitf9c01cebc9dea69d475bfa152dd09c7acdc7503e
tree2213331ef48ba5c35c92f2c1194f3d198fda984f
parent3b93b74482710def5d24d7206b93e38d900101b6
net, sysctl: Fix compiler warning when only cBPF is present

proc_dointvec_minmax_bpf_restricted() has been firstly introduced
in commit c0c3b2a2854a ("bpf: restrict access to core bpf sysctls")
under CONFIG_HAVE_EBPF_JIT. Then, this ifdef has been removed in
884d96a1e0ba ("bpf: add bpf_jit_limit knob to restrict unpriv
allocations"), because a new sysctl, bpf_jit_limit, made use of it.
Finally, this parameter has become long instead of integer with
8be436a4ca54 ("bpf: fix bpf_jit_limit knob for PAGE_SIZE >= 64K")
and thus, a new proc_dolongvec_minmax_bpf_restricted() has been
added.

With this last change, we got back to that
proc_dointvec_minmax_bpf_restricted() is used only under
CONFIG_HAVE_EBPF_JIT, but the corresponding ifdef has not been
brought back.

So, in configurations like CONFIG_BPF_JIT=y && CONFIG_HAVE_EBPF_JIT=n
since v4.20 we have:

  CC      net/core/sysctl_net_core.o
net/core/sysctl_net_core.c:292:1: warning: ‘proc_dointvec_minmax_bpf_restricted’ defined but not used [-Wunused-function]
  292 | proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Suppress this by guarding it with CONFIG_HAVE_EBPF_JIT again.

Fixes: 8be436a4ca54 ("bpf: fix bpf_jit_limit knob for PAGE_SIZE >= 64K")
Signed-off-by: Alexander Lobakin <alobakin@dlink.ru>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20191218091821.7080-1-alobakin@dlink.ru
net/core/sysctl_net_core.c