[PATCH] cmd: mtd: Prevent use of uninitialised variable

Andrew Goodbody andrew.goodbody at linaro.org
Thu Jun 26 13:29:54 CEST 2025


On 26/06/2025 12:14, Quentin Schulz wrote:
> Hi Andrew,
> 
> On 6/26/25 12:49 PM, Andrew Goodbody wrote:
>> ret maybe used uninitialised in some cases so instead
>> initialise it first to prevent this.
>>
> 
> I don't believe that's true, can you tell us which code path(s) could 
> trigger this because I didn't find one the 2min I spent reading the code.

No error path taken before line 563, ret is still not assigned to.
remaining == 0 which could come from being passed 0 on the command line, 
line 518, unless there is a check for that that I missed?
Code reaches line 591 without assigning to ret.

Andrew

>> This issue was found by Smatch.
>>
> 
> Seems like a false positive to me?
> 
> Cheers,
> Quentin



More information about the U-Boot mailing list