bpf: hide the unused 'off' variable
authorYueHaibing <yuehaibing@huawei.com>
Tue, 29 May 2018 02:40:18 +0000 (10:40 +0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 29 May 2018 19:45:35 +0000 (21:45 +0200)
The local variable is only used while CONFIG_IPV6 enabled

net/core/filter.c: In function ‘sk_msg_convert_ctx_access’:
net/core/filter.c:6489:6: warning: unused variable ‘off’ [-Wunused-variable]
  int off;
      ^
This puts it into #ifdef.

Fixes: 303def35f64e ("bpf: allow sk_msg programs to read sock fields")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
net/core/filter.c

index 24e6ce8be567e6750e4a4e0e3275de4e33860ab5..0ce93edefb0ed8ccc09b042200a726c14ee6bc4c 100644 (file)
@@ -6486,7 +6486,9 @@ static u32 sk_msg_convert_ctx_access(enum bpf_access_type type,
                                     struct bpf_prog *prog, u32 *target_size)
 {
        struct bpf_insn *insn = insn_buf;
+#if IS_ENABLED(CONFIG_IPV6)
        int off;
+#endif
 
        switch (si->off) {
        case offsetof(struct sk_msg_md, data):