From patchwork Fri Sep 30 16:05:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101729 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp372666qgf; Fri, 30 Sep 2016 09:06:37 -0700 (PDT) X-Received: by 10.66.83.132 with SMTP id q4mr13018780pay.22.1475251597411; Fri, 30 Sep 2016 09:06:37 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id af8si20690928pad.16.2016.09.30.09.06.36; Fri, 30 Sep 2016 09:06:37 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933857AbcI3QGe (ORCPT + 27 others); Fri, 30 Sep 2016 12:06:34 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:53410 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933562AbcI3QGc (ORCPT ); Fri, 30 Sep 2016 12:06:32 -0400 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue101) with ESMTPA (Nemesis) id 0MCIPR-1bhVrh1t5N-009C0k; Fri, 30 Sep 2016 18:06:12 +0200 From: Arnd Bergmann To: Pablo Neira Ayuso Cc: Arnd Bergmann , 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: [PATCH 1/3] netfilter: nf_tables: avoid uninitialized variable warning Date: Fri, 30 Sep 2016 18:05:34 +0200 Message-Id: <20160930160559.4102745-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:kdHzkWShraDq5QmTuELwTcHgjtvjvCld92BUz223aIsODRWk4c1 xI2YPFEjRbuE2c1MtDWkgIUlYj0S253lIFdwrb5ssY5Kwp6LRMITmDdIWArv53+c7VX4Rhl 0NPWxlyKGn8JKLxKyhAjgna6X7rXrK8a14RAA00Ly6zeLYFUgPXnTdJhDxYA6jkd6SKukKC HrhHPWdY5f3RM2IOKxx1Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:uz+RqLdnOTY=:q8TV60SS2RDxxdWW9RwQ72 CLxToGX8a3bZmgmQQPLqOC3MNMso1OFq1jrd64rb7lsI4YxThVf1eBXvnbmZNXTJ+E+uhAYMJ JJonGVn7Evp+qdvX/8RpxoANel5BJcVlqmWz4LUgeVQttOS7XMEJi+pP+oPp1F6GTK2bJY76v gtDHIRSQ5GhsY+tjnGrcAJ3nHhYe61qYeUqul85QboeOJRr5F+iCqg177fRMMSb+5g68WbBvG Hv54xp5mDj24u6iSac7MXsUAW6pYieHUnreJrFNcUS5SQDUdhBczIseFEEeWxb/MCDfpUQ2+1 aQPrufJ0l6v238KQBJ/pg+JdQ7KB5eJhY3Fw4A05/RSTta8YekJnXhCnwQzaIITKBtbwkoMHx lhXNUfDbUVcqzmpTrn13evsakMANojA1z1YkizfVE8l9fqR4Y74j2eB/SgPLojQMuiUCJNo65 6QNMvjY2q+v5l7JwSz7JgLgoVyJlz+hhwtXn6GW8wvg7QvEBvAyBKs0c0BYFP2LsYj4aXUgDp DQKESnFgwSyBqpaM5Cavok7HHR5FICRcgO+mny0BJ63zp6O7eoc4wlFCMjAjIatoQaOnhYrRo 7OenVfCTt6BC306/rI3MSUDmi8/I3VrZ3wHy6xvFzSXo4cLHzMoVjj0hpxCeRrLJym925UDfY knja5PpgKau9OVwWBs0nU5kU0/es/pDww44nfB+jnKq4zkcYKvJpGw2u9jKQdDMepI+8= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Fixes: 0f3cd9b36977 ("netfilter: nf_tables: add range expression") Signed-off-by: Arnd Bergmann --- net/netfilter/nft_range.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.9.0 diff --git a/net/netfilter/nft_range.c b/net/netfilter/nft_range.c index c6d5358482d1..72dff5bffca8 100644 --- a/net/netfilter/nft_range.c +++ b/net/netfilter/nft_range.c @@ -40,6 +40,8 @@ static void nft_range_eval(const struct nft_expr *expr, case NFT_RANGE_NEQ: mismatch = (d1 >= 0 && d2 <= 0); break; + default: + mismatch = 0; } if (mismatch)