diff options
| author | Franco Venturi <[email protected]> | 2024-07-31 09:09:00 -0400 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2024-08-27 18:04:05 -0600 |
| commit | cf85cd84aa1a396126448b6d405e458d15f42976 (patch) | |
| tree | 939787642bbf9e23de26e007dc0170bcd018cede /include/linux/string.h | |
| parent | 7c2c235a27c7b7198742f37fbe20877e17b6e3ea (diff) | |
mmc: fix signed vs unsigned compare in read check in _spl_load()
Fix signed vs unsigned compare in read check in _spl_load()
Issue: when info->read() returns a negative value because of an error,
the comparison of 'read' (signed) with 'sizeof(*header)'
(unsigned silently converts the negative value into a very
large unsigned value and the check on the error condition
always return false, i.e. the error is not detected
Symptoms: if spl_load_image_fat() is unable to find the file 'uImage',
the SPL phase of the boot process just hangs after displaying
the following line:
Trying to boot from MMC1
Fix: cast 'sizeof(*header)' to int so the compare is now between
signed types
Reference: https://stackoverflow.com/questions/17293749/sizeof-operator-in-if-statement
Signed-off-by: Franco Venturi <[email protected]>
Reviewed-by: Sean Anderson <[email protected]>
Reviewed-by: Peng Fan <[email protected]>
Diffstat (limited to 'include/linux/string.h')
0 files changed, 0 insertions, 0 deletions
