From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752204AbcJCFcj (ORCPT ); Mon, 3 Oct 2016 01:32:39 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:38398 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750989AbcJCFc2 (ORCPT ); Mon, 3 Oct 2016 01:32:28 -0400 Date: Mon, 03 Oct 2016 01:32:25 -0400 (EDT) Message-Id: <20161003.013225.2126712838089878159.davem@davemloft.net> To: arnd@arndb.de Cc: roopa@cumulusnetworks.com, nicolas.dichtel@6wind.com, nikolay@cumulusnetworks.com, jiri@mellanox.com, edumazet@google.com, bblanco@plumgrid.com, hannes@stressinduktion.org, nogahf@mellanox.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: rtnl: avoid uninitialized data in IFLA_VF_VLAN_LIST handling From: David Miller In-Reply-To: <20160930161416.18660-1-arnd@arndb.de> References: <20160930161416.18660-1-arnd@arndb.de> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Sun, 02 Oct 2016 22:32:28 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann Date: Fri, 30 Sep 2016 18:13:49 +0200 > With the newly added support for IFLA_VF_VLAN_LIST netlink messages, > we get a warning about potential uninitialized variable use in > the parsing of the user input when enabling the -Wmaybe-uninitialized > warning: > > net/core/rtnetlink.c: In function 'do_setvfinfo': > net/core/rtnetlink.c:1756:9: error: 'ivvl$' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > I have not been able to prove whether it is possible to arrive in > this code with an empty IFLA_VF_VLAN_LIST block, but if we do, > then ndo_set_vf_vlan gets called with uninitialized arguments. > > This adds an explicit check for an empty list, making it obvious > to the reader and the compiler that this cannot happen. > > Fixes: 79aab093a0b5 ("net: Update API for VF vlan protocol 802.1ad support") > Signed-off-by: Arnd Bergmann Applied, thanks.