From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933778AbcI3SqA (ORCPT ); Fri, 30 Sep 2016 14:46:00 -0400 Received: from ganesha.gnumonks.org ([213.95.27.120]:56783 "EHLO ganesha.gnumonks.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933227AbcI3Spy (ORCPT ); Fri, 30 Sep 2016 14:45:54 -0400 X-Greylist: delayed 1454 seconds by postgrey-1.27 at vger.kernel.org; Fri, 30 Sep 2016 14:45:53 EDT Date: Fri, 30 Sep 2016 20:21:29 +0200 From: Pablo Neira Ayuso To: Arnd Bergmann Cc: Patrick McHardy , Jozsef Kadlecsik , "David S. Miller" , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] netfilter: nf_tables: avoid uninitialized variable warning Message-ID: <20160930182006.GA1767@salvia> References: <20160930160559.4102745-1-arnd@arndb.de> <20160930174749.GF1176@salvia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160930174749.GF1176@salvia> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Score: -0.2 (/) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 30, 2016 at 07:47:49PM +0200, Pablo Neira Ayuso wrote: > On Fri, Sep 30, 2016 at 06:05:34PM +0200, Arnd Bergmann wrote: > > 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: > > > > net/netfilter/nft_range.c: In function 'nft_range_eval': > > net/netfilter/nft_range.c:45:5: error: 'mismatch' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > > > This can be trivially avoided by added a 'default:' clause. > > Applied this patch, I took Aaron's and Pai's patches instead. Looking at this again, I know uninitialized_var() has been discussed as not nice since it can hide bugs behind. But if I fix the existing code to validate priv->op from _init() (this is currently broken), we can probably use this so save extra code in the packet path for a case that is not going to happen. Let me know, thanks!