netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/netfilter: Fix use uninitialized warn in nft_range_eval()
       [not found] <20161107154114.26803-1-shuahkh@osg.samsung.com>
@ 2016-11-07 15:41 ` Shuah Khan
  2016-11-08 23:13   ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Shuah Khan @ 2016-11-07 15:41 UTC (permalink / raw)
  To: pablo, kaber, kadlec, davem
  Cc: Shuah Khan, netfilter-devel, coreteam, netdev, linux-kernel

Fix the following warn:

   CC [M]  net/netfilter/nft_range.o
8601,8605c9105
 net/netfilter/nft_range.c: In function ‘nft_range_eval’:
 net/netfilter/nft_range.c:45:5: warning: ‘mismatch’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   if (mismatch)
      ^

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 net/netfilter/nft_range.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/nft_range.c b/net/netfilter/nft_range.c
index c6d5358..fe5f69b 100644
--- a/net/netfilter/nft_range.c
+++ b/net/netfilter/nft_range.c
@@ -28,7 +28,7 @@ static void nft_range_eval(const struct nft_expr *expr,
 			 const struct nft_pktinfo *pkt)
 {
 	const struct nft_range_expr *priv = nft_expr_priv(expr);
-	bool mismatch;
+	bool mismatch = false;
 	int d1, d2;
 
 	d1 = memcmp(&regs->data[priv->sreg], &priv->data_from, priv->len);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net/netfilter: Fix use uninitialized warn in nft_range_eval()
  2016-11-07 15:41 ` [PATCH] net/netfilter: Fix use uninitialized warn in nft_range_eval() Shuah Khan
@ 2016-11-08 23:13   ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2016-11-08 23:13 UTC (permalink / raw)
  To: Shuah Khan
  Cc: kaber, kadlec, davem, netfilter-devel, coreteam, netdev,
	linux-kernel

On Mon, Nov 07, 2016 at 08:41:14AM -0700, Shuah Khan wrote:
> Fix the following warn:
> 
>    CC [M]  net/netfilter/nft_range.o
> 8601,8605c9105
>  net/netfilter/nft_range.c: In function ‘nft_range_eval’:
>  net/netfilter/nft_range.c:45:5: warning: ‘mismatch’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>    if (mismatch)
>       ^

You probably using an old tree snapshot? This was already fixed by:

commit d2e4d593516e877f1f6fb40031eb495f36606e16
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Tue Oct 18 00:05:30 2016 +0200

    netfilter: nf_tables: avoid uninitialized variable warning

    The newly added nft_range_eval() function handles the two possible
    nft range operations, but as the compiler warning points out,
    any unexpected value would lead to the 'mismatch' variable being
    used without being initialized:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-08 23:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20161107154114.26803-1-shuahkh@osg.samsung.com>
2016-11-07 15:41 ` [PATCH] net/netfilter: Fix use uninitialized warn in nft_range_eval() Shuah Khan
2016-11-08 23:13   ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).