[PATCH] IOMUX: Fix access past end of console_devices

Andrew Scull ascull at google.com
Sun Apr 3 09:45:31 CEST 2022


I found this same problem with some ASAN experiments I've been playing
with, and addressed it in the same way.


> I don't see good solution. :-(
>

There's always the option of reverting the refactor as it applies to just a
small number of cases and is making it harder to write the correct logic.


> Maybe moving to dev as a loop variable and having NULL terminated arrays
> should fix that.
>

Doing this just to fix the syntactic sugar feels like addressing the wrong
problem.


> For now probably your solution is a good compromise.
> But, please rewrite it to have all three more visible in a for-loop:
>
>         for (i = 0;                                                     \
>              i < cd_count[file] && (dev = console_devices[file][i]);    \
>              i++)
>

With reformatting

Reviewed-by: Andrew Scull <ascull at google.com>


More information about the U-Boot mailing list