]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: nft_bitwise: Adjust parentheses to fix memcmp size argument
authorNathan Chancellor <natechancellor@gmail.com>
Wed, 14 Aug 2019 16:58:09 +0000 (09:58 -0700)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 14 Aug 2019 21:36:45 +0000 (23:36 +0200)
commit1f81586c5a1b048db89cc096b8d5eac304ab3295
tree703a8880260c76dc43329658f797545edda6c7a2
parent5ed62d34e99beb061e013c92a774e957b66446e4
netfilter: nft_bitwise: Adjust parentheses to fix memcmp size argument

clang warns:

net/netfilter/nft_bitwise.c:138:50: error: size argument in 'memcmp'
call is a comparison [-Werror,-Wmemsize-comparison]
        if (memcmp(&priv->xor, &zero, sizeof(priv->xor) ||
                                      ~~~~~~~~~~~~~~~~~~^~
net/netfilter/nft_bitwise.c:138:6: note: did you mean to compare the
result of 'memcmp' instead?
        if (memcmp(&priv->xor, &zero, sizeof(priv->xor) ||
            ^
                                                       )
net/netfilter/nft_bitwise.c:138:32: note: explicitly cast the argument
to size_t to silence this warning
        if (memcmp(&priv->xor, &zero, sizeof(priv->xor) ||
                                      ^
                                      (size_t)(
1 error generated.

Adjust the parentheses so that the result of the sizeof is used for the
size argument in memcmp, rather than the result of the comparison (which
would always be true because sizeof is a non-zero number).

Fixes: 11b08f8b190a ("netfilter: nft_bitwise: add offload support")
Link: https://github.com/ClangBuiltLinux/linux/issues/638
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nft_bitwise.c