Skip to contentSkip to conversation

net/netfilter/nft_bitwise.c:138:50: warning: size argument in 'memcmp' call is a comparison

PATCH Nick Desaulniers 1 participant 1 message Aug 13, 2019 1 message not in the archive netfilter

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 201908140300.REaRIkQ8%[email protected]

#1 lore raw

+ Pablo, looks like the closing parens need to be adjusted.

Quoted 56 lines · kbuild test robot

CC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Pablo Neira Ayuso <[email protected]>

tree:   https://kernel.googlesource.com/pub/scm/linux/kernel/git/pablo/nf-next.git master
head:   105333435b4f3b21ffc325f32fae17719310db64
commit: bd8699e9e29287b5571b32b68c3dcd05985fa9b1 [5/17] netfilter: nft_bitwise: add offload support
config: x86_64-rhel-7.6 (attached as .config)
compiler: clang version 10.0.0 (git://gitmirror/llvm_project 45a3fd206fb06f77a08968c99a8172cbf2ccdd0f)
reproduce:
        git checkout bd8699e9e29287b5571b32b68c3dcd05985fa9b1
        # save the attached .config to linux build tree
        make ARCH=x86_64

If you fix the issue, kindly add following tag

All warnings (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

net/netfilter/nft_bitwise.c:138:50: warning: size argument in 'memcmp' call is a comparison [-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 warning generated.

vim +/memcmp +138 net/netfilter/nft_bitwise.c

   131
   132  static int nft_bitwise_offload(struct nft_offload_ctx *ctx,
   133                                 struct nft_flow_rule *flow,
   134                                 const struct nft_expr *expr)
   135  {
   136          const struct nft_bitwise *priv = nft_expr_priv(expr);
   137
Quoted 1 line

138 if (memcmp(&priv->xor, &zero, sizeof(priv->xor) ||

139 priv->sreg != priv->dreg))

   140                  return -EOPNOTSUPP;
   141
   142          memcpy(&ctx->regs[priv->dreg].mask, &priv->mask, sizeof(priv->mask));
   143
   144          return 0;
   145  }
   146

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Signature · 2 lines
Thanks,
~Nick Desaulniers