Re: InfiniBand-ocrdma: Delete unnecessary variable initialisations in 11 functions

From: Leon Romanovsky
Date: Fri Jan 15 2016 - 12:42:06 EST


On Fri, Jan 15, 2016 at 09:19:38AM -0800, Bart Van Assche wrote:
> On 01/15/2016 09:00 AM, Leon Romanovsky wrote:
> >On Fri, Jan 15, 2016 at 05:24:50PM +0100, SF Markus Elfring wrote:
> >
> >Since, you didn't answer to my original question, I will repeat it again.
> >[Q.] What did you try to achieve by this patch?
>
> Hello Leon,
>
> Have you noticed Dan's reply: "Doing bogus initializations turns off GCC's
> checking for uninitialized variables so it's a bad habit."

Yes and his second part of that message too, that uninitialized
checks in GCC work as not as expected [1, 2].

Stackoverflow site has a lot examples of these types of bugs [3].
These examples together with Dan's suggestion requires from all
reviewers to be extra cautions when removing variable initialization.

[1] https://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
[2] https://gcc.gnu.org/bugzilla/buglist.cgi?quicksearch=may%20be%20uninitialized
[3] http://stackoverflow.com/questions/27063678/compiler-not-detecting-obviously-uninitialized-variable

>
> Thanks,
>
> Bart.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html