Re: [PATCH] Removes warning related to use of uninitialized variable i

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> If you just set it to NULL, how could it ever not be NULL, so why add
> this check?
>
Because, there is an assignment to i inside the for-each loop (hlist_for_each)
if it enters the loop.

> Also, no, this isn't correct, i is used in the hlist traversal.
>
Indeed it is being used but what if it doesn't enters the loop i.e. if
h->first is NULL
It is a different issue whether (h->first != NULL) is a precondition
to this function
but the compiler is warning because there exists a path to access of i->head
where it might be left uninitialized.

-- 
Regards,
Sukanto Ghosh
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux