bpf: add parenthesis around argument of BPF_LDST_BYTES()
authorJakub Kicinski <jakub.kicinski@netronome.com>
Thu, 29 Mar 2018 00:48:33 +0000 (17:48 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 29 Mar 2018 02:36:13 +0000 (19:36 -0700)
BPF_LDST_BYTES() does not put it's argument in parenthesis
when referencing it.  This makes it impossible to pass pointers
obtained by address-of operator (e.g. BPF_LDST_BYTES(&insn)).
Add the parenthesis.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/filter.h

index 109d05ccea9a4f2cc6de63871f473378088c4a8f..c2f167db8bd5ccace957e97c49c9a6f048859743 100644 (file)
@@ -372,7 +372,7 @@ struct xdp_rxq_info;
 
 #define BPF_LDST_BYTES(insn)                                   \
        ({                                                      \
-               const int __size = bpf_size_to_bytes(BPF_SIZE(insn->code)); \
+               const int __size = bpf_size_to_bytes(BPF_SIZE((insn)->code)); \
                WARN_ON(__size < 0);                            \
                __size;                                         \
        })