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

Quentin Schulz quentin.schulz at cherry.de
Thu Jun 26 13:32:46 CEST 2025


Hi Andrew,

On 6/26/25 1:29 PM, Andrew Goodbody wrote:
> 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.
> 

Indeed, clearly missed that!

Reviewed-by: Quentin Schulz <quentin.schulz at cherry.de>

Thanks!
Quentin


More information about the U-Boot mailing list