Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1144745ybl; Wed, 14 Aug 2019 11:26:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqy3S9S4VS8uWL9/65Lo0qyo1V0ADIajWJ9MCGU78nRcOTOpViacAxALOg1L1z5plxKzBQu8 X-Received: by 2002:a17:902:6a84:: with SMTP id n4mr694707plk.109.1565807192680; Wed, 14 Aug 2019 11:26:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565807192; cv=none; d=google.com; s=arc-20160816; b=CSRezOWumQ9mGZLid50W//0UOf/wEpsxNSvyvIIRgjm3TIzT7SUw6rkahHcmFR/HN5 EAgG/v4QKr2SwiTpYveaeV/DNcwKiTT0hwidQG0UztA7DlY8Q3jEIMg53eyNa+FHDgwT 5/h3q+ybaas0iquE4O1yG9Tg8MbMQy9uuIfwc/U8ZXTXf8zpzJoivgSgwbF8qSBVIgZi +3m8aShV2GHMwV466Kwrkv+VEqEFf/+yv5kO4AWvI5dU4liMErE35SzbFF0MNb3ZRWq4 notxS0OekTz1yQYNu+qnbHBfHkmi44C6z3BK6CrvGhP2Y98i7WpVcvvU4vQfrQ1V67wf Ychw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=dj4KAX4oiOlHlXT1vUtLuT1vYXvby2UL10kTcUOrNVU=; b=Nxji6m8caXpI5XnBy4ZBwAAf56UcMaVyeC6gVUm8z9ivrGcTvm1ikHgwSWRsFAwBAQ pcUgwsAK42k/Msi5uFWdT2kTxKOvfbZYPrDURIkk4lre812j7+yzweRT9vU3RVYy/Cl8 6/ILfbt1oDbc44ycSgDJrObwbCck5kMbsPGbGLZsayLkDWb7gkKCCR1Jy0zrVkn0BGDz 3lB2dYaw1bzdEoYPY2kp50eUCFkL3hDS2jnEZ3oZV7+WK3nttM7v6QHGMGyTVk39pXy6 QCaHMHkTnaObPSRb5jK5D6cc4r3/4PWFHJYfRC1huZEKQbK9fyT2jw+N3j+OMSWNSvTp +UGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=aVjpnrjN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y11si295107pgo.115.2019.08.14.11.26.16; Wed, 14 Aug 2019 11:26:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=aVjpnrjN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729154AbfHNSZV (ORCPT + 99 others); Wed, 14 Aug 2019 14:25:21 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:42339 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729109AbfHNSZV (ORCPT ); Wed, 14 Aug 2019 14:25:21 -0400 Received: by mail-pf1-f196.google.com with SMTP id i30so5354125pfk.9 for ; Wed, 14 Aug 2019 11:25:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dj4KAX4oiOlHlXT1vUtLuT1vYXvby2UL10kTcUOrNVU=; b=aVjpnrjNjtev+v0rOvs8haZujsIS+SKSncIJWkjkfISt434mYvH9ZXTPW8wBD5bGPC o8SRuLOWToAWroJNjgL9mzkUg7pZL0rg9adAlql+R+78AjCyhV+sU3P0rmKZnNHhDq+Y cEVrmLlVbqJ8RvxQU6HF1D7onDXD6y79XuyZ3wBbiBgOCGGad+d2p7DoBN0YkWVjtRv8 cXA/Tx/2iGDkeuY0xn6JOEzKk9UW/gSVIlOE4AeQfT6Nx8/GYwWEGSP/Oo++j+VyTGNj hEtA5/sv1Nv3mH/GumYlvjJsqc92BETeL6d2WiboFtAgkgTSaiGT3u7TkLGJ7IJ9RIRF L3lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dj4KAX4oiOlHlXT1vUtLuT1vYXvby2UL10kTcUOrNVU=; b=jY1CzoY+QEkhab912kHpgzP9gLL6EJTTO7FUlz/013zGKlbBahGOORT+TXprOdChVu kHNytqgH2N8TIv4khK982FSsUvGYG7QA/ejhWjsdTuCnvsDm6e71ODHF7VvH4qk9M0V6 /Qz2YbS4X9viRaAXh3rP2oNhyMHAa0maJRoVKzmw949vPsUKdEYGvy/aNt1XvTnfiimA MActVsF1OJDWhHL+xQIcPAxLY42zfl2vGGr5MPvcMfh2L1SXlbn6ilVBeN6h4039qiyv sZZl63k+dgodwAfF/EAH5hIvGB73wax3BPxHwj6FPD3t41QIWjGI6SCx61SkRpSmK2Ph C0ww== X-Gm-Message-State: APjAAAU/cQOdT7vsqH0euLVmYKJ1h/5m0RYEcejh25vyxQZzdXcXztFZ VdbvH3gHATHgNV13EDwJ31e/nwZNW9FiGIXBt3fMWBhNlig= X-Received: by 2002:aa7:984a:: with SMTP id n10mr1326537pfq.3.1565807120061; Wed, 14 Aug 2019 11:25:20 -0700 (PDT) MIME-Version: 1.0 References: <20190814165809.46421-1-natechancellor@gmail.com> In-Reply-To: <20190814165809.46421-1-natechancellor@gmail.com> From: Nick Desaulniers Date: Wed, 14 Aug 2019 11:25:08 -0700 Message-ID: Subject: Re: [PATCH] netfilter: nft_bitwise: Adjust parentheses to fix memcmp size argument To: Nathan Chancellor Cc: Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, LKML , clang-built-linux , kbuild test robot Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 14, 2019 at 9:58 AM Nathan Chancellor wrote: > > 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: bd8699e9e292 ("netfilter: nft_bitwise: add offload support") > Link: https://github.com/ClangBuiltLinux/linux/issues/638 > Reported-by: kbuild test robot > Signed-off-by: Nathan Chancellor oh no! thanks for the patch. Reviewed-by: Nick Desaulniers > --- > net/netfilter/nft_bitwise.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/net/netfilter/nft_bitwise.c b/net/netfilter/nft_bitwise.c > index 1f04ed5c518c..974300178fa9 100644 > --- a/net/netfilter/nft_bitwise.c > +++ b/net/netfilter/nft_bitwise.c > @@ -135,8 +135,8 @@ static int nft_bitwise_offload(struct nft_offload_ctx *ctx, > { > const struct nft_bitwise *priv = nft_expr_priv(expr); > > - if (memcmp(&priv->xor, &zero, sizeof(priv->xor) || > - priv->sreg != priv->dreg)) > + if (memcmp(&priv->xor, &zero, sizeof(priv->xor)) || > + priv->sreg != priv->dreg) > return -EOPNOTSUPP; > > memcpy(&ctx->regs[priv->dreg].mask, &priv->mask, sizeof(priv->mask)); > -- > 2.23.0.rc2 > -- Thanks, ~Nick Desaulniers