Subject: Re: [PATCH] net, mellanox mlx4 Fix compile warnings

From: Prarit Bhargava <[email-masked]>
Date: Mon, 16 Sep 2013 08:14:50 -0400

On 09/16/2013 04:59 AM, David Laight wrote:
>> On Sat, 14 Sep 2013 22:10:19 +0300
>> Or Gerlitz <[email-masked]> wrote:
>>
>>>> +       struct res_cq *uninitialized_var(cq);
>>>>
>>>>         err = cq_res_start_move_to(dev, slave, cqn,
>>>> RES_CQ_ALLOCATED, &cq);
>>
>> I have no objection. However, I don't know if the compiler is being too
>> clever here or too stupid.  The cq variable is initialized in
>> cq_res_start_move_to(), but the compiler is ignoring this -- or maybe
>> it is simply not assuming that cq will in fact be
>> initialized by the called procedure?
> 
> Possibly cq_res_start_move_to() got inlined - and the analysis
> of the inlined code found a path where it wasn't initialised.
> 
> Most likely one of the paths where the return value is non-zero.
> 
>> In any event, this change cannot hurt.
> 
> It could hide a real 'used but not initialised' error later on...

Hi David,

I certainly don't profess to know the code better than you do of course, but in
terms of risk we're no better in than the original code here, and it seems that
other places in the kernel the resolution has been to either init to NULL or
wrap with uninitialized_var()...

P.