[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190801080343.GA1935@kadam>
Date: Thu, 1 Aug 2019 11:03:43 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Aurélien Aptel <aaptel@...e.com>
Cc: Colin King <colin.king@...onical.com>,
samba-technical@...ts.samba.org, Steve French <sfrench@...ba.org>,
kernel-janitors@...r.kernel.org, linux-cifs@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cifs: remove redundant assignment to variable rc
On Wed, Jul 31, 2019 at 05:34:39PM +0200, Aurélien Aptel wrote:
> "Dan Carpenter" <dan.carpenter@...cle.com> writes:
> > You're just turning off GCC's static analysis (and introducing false
> > positives) when you do that. We have seen bugs caused by this and never
> > seen any bugs prevented by this style.
>
> You've never seen bugs prevented by initializing uninitialized
> variables? Code can change overtime and I don't think coverity is
> checked as often as it could be, meaning the var could end up being used
> while uninitialized in the future.
Of course, we wouldn't see bugs that were prevented so that wasn't
entirely fair.
There is a several year old bug in GCC where it sometimes initializes
these to zero and doesn't warn about the uninitialized variable so it
is actually possible to prevent a bug by initializing it to an error
code.
Smatch also warns about uninitialized variables. I normally run Smatch
on linux-next every day but I have been out of office for the past
month and my config doesn't cover everything.
We haven't been able to enable this "redundant assignment" warning
because of all the false positives like this. It mostly finds dead code
but it also does find some bugs where we forget to check the error code
or we use the wrong variable.
regards,
dan carpenter
Powered by blists - more mailing lists