[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <018ada52-3e9b-8909-2346-ea2ce1d817fa@gmail.com>
Date: Thu, 18 Nov 2021 12:00:21 +0300
From: Pavel Skripkin <paskripkin@...il.com>
To: Johan Hovold <johan@...nel.org>,
Dan Carpenter <dan.carpenter@...cle.com>
Cc: aelior@...vell.com, skalluru@...vell.com,
GR-everest-linux-l2@...vell.com, davem@...emloft.net,
kuba@...nel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: bnx2x: fix variable dereferenced before check
On 11/18/21 11:51, Johan Hovold wrote:
> [ Adding Dan. ]
>
> On Sun, Nov 14, 2021 at 01:36:36AM +0300, Pavel Skripkin wrote:
>> Smatch says:
>> bnx2x_init_ops.h:640 bnx2x_ilt_client_mem_op()
>> warn: variable dereferenced before check 'ilt' (see line 638)
>>
>> Move ilt_cli variable initialization _after_ ilt validation, because
>> it's unsafe to deref the pointer before validation check.
>
> It seems smatch is confused here. There is no dereference happening
> until after the check, we're just determining the address when
> initialising ilt_cli.
>
> I know this has been applied, and the change itself is fine, but the
> patch description is wrong and the Fixes tag is unwarranted.
>
I agree. I came up with same thing after the patch has been applied. I
thought about a revert, but seems it's not necessary, since there is no
function change.
I should check smatch warnings more carefully next time, can't say why I
didn't notice it before sending :(
thanks
With regards,
Pavel Skripkin
Powered by blists - more mailing lists