From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Tue, 24 Sep 2019 09:21:00 +0000 Subject: Re: [PATCH] IB/mlx5: add checking for "vf" from do_setvfinfo() Message-Id: <20190924091823.GM20699@kadam> List-Id: References: <20190415094610.GO6095@kadam> <20190416082112.GA27670@kadam> <20190420095102.GA14798@kadam> <20190423154943.GC14820@kadam> <20190424140820.GB14798@kadam> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Parav Pandit Cc: "netdev@vger.kernel.org" , Leon Romanovsky , Eli Cohen , Doug Ledford , Jason Gunthorpe , "linux-rdma@vger.kernel.org" , "kernel-janitors@vger.kernel.org" On Thu, Apr 25, 2019 at 06:15:13AM +0000, Parav Pandit wrote: > > > > -----Original Message----- > > From: Dan Carpenter > > Sent: Wednesday, April 24, 2019 9:08 AM > > To: Parav Pandit ; netdev@vger.kernel.org > > Cc: Leon Romanovsky ; Eli Cohen ; > > Doug Ledford ; Jason Gunthorpe ; > > linux-rdma@vger.kernel.org; kernel-janitors@vger.kernel.org > > Subject: Re: [PATCH] IB/mlx5: add checking for "vf" from do_setvfinfo() > > > > I think I'm just going to ask netdev for an opinion on this. It could be that > > we're just reading the code wrong... > > > > I'm getting a lot of Smatch warning about buffer underflows. The problem is > > that Smatch marks everything from nla_data() as unknown and untrusted > > user data. In do_setvfinfo() we get the "->vf" values from nla_data(). It > > starts as u32, but all the function pointers in net_device_ops use it as a > > signed integer. Most of the functions return -EINVAL if "vf" is negative but > > there are at least 48 which potentially use negative values as an offset into > > an array. > > > > To me making "vf" a u32 throughout seems like a good idea but it's an > > extensive patch and I'm not really able to test it at all. > > I will be try to get you patch early next week for core and in mlx5, > tested on mlx5 VFs, that possibly you can carry forward? Whatever happened with this? regards, dan carpenter