From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933039AbcI3UMx (ORCPT ); Fri, 30 Sep 2016 16:12:53 -0400 Received: from mail-oi0-f42.google.com ([209.85.218.42]:36523 "EHLO mail-oi0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750703AbcI3UMm (ORCPT ); Fri, 30 Sep 2016 16:12:42 -0400 MIME-Version: 1.0 In-Reply-To: <20160930161416.18660-1-arnd@arndb.de> References: <20160930161416.18660-1-arnd@arndb.de> From: Or Gerlitz Date: Fri, 30 Sep 2016 23:12:40 +0300 Message-ID: Subject: Re: [PATCH] net: rtnl: avoid uninitialized data in IFLA_VF_VLAN_LIST handling To: Arnd Bergmann , Moshe Shemesh , Tariq Toukan Cc: "David S. Miller" , Roopa Prabhu , Nicolas Dichtel , Nikolay Aleksandrov , Jiri Pirko , Eric Dumazet , Brenden Blanco , Hannes Frederic Sowa , Nogah Frankel , Linux Netdev List , Linux Kernel Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 30, 2016 at 7:13 PM, Arnd Bergmann wrote: > 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") Added the authors of the above patch > Signed-off-by: Arnd Bergmann