spl: fix ext4fs_mount return code handling
PATCH 1/1 spl: fix ext4fs_mount return code handling
From: Thomas Schaefer <[email protected]>
- Despite other ext4 filesystem functions, ext4fs_mount returns 0 in case of error.
- This leads to u-boot crash in case that an SD card
with valid partition table but without ext4 filesystem created in a partition is found on SD card.
- Fix this by returning a proper error code of '-1' from spl_load_image_ext function in case of ext4fs_mount error.
--- common/spl/spl_ext.c | 1 + 1 file changed, 1 insertion(+)
common/spl/spl_ext.c +1 -0
@@ -32,6 +32,7 @@ int spl_load_image_ext(struct spl_image_info *spl_image,#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf ("%s: ext4fs mount err - %d\n" , __func__, err);#endif + err =-1 ;/* ext4fs_mount returns 0 in case of error! */ goto end; }
Signature · 1 line
2.20.1
PATCH 1/1 spl: fix ext4fs_mount return code handling
Quoted 22 lines · Heiko Thiery
From: Thomas Schaefer <[email protected]>
- Despite other ext4 filesystem functions,
ext4fs_mountreturns 0 in case of error.
- This leads to u-boot crash in case that an SD card
with valid partition table but without ext4 filesystem created in a partition is found on SD card.
- Fix this by returning a proper error code of '-1' fromspl_load_image_extfunction in case ofext4fs_mounterror.Signed-off-by Thomas Schaefer <[email protected]>[hthiery: slightly reword the commit message]Signed-off-by Heiko Thiery <[email protected]>--- common/spl/spl_ext.c | 1 + 1 file changed, 1 insertion(+)common/spl/spl_ext.c +0
-0
common/spl/spl_ext.c int spl_load_image_ext(struct spl_image_info *spl_image, · line 37
Quoted 6 lines
common/spl/spl_ext.c +1
-0@@ -32,6 +32,7 @@ int spl_load_image_ext(struct spl_image_info *spl_image,#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf ("%s: ext4fs mount err - %d\n" , __func__, err);#endif + err =-1 ;/* ext4fs_mount returns 0 in case of error! */ goto end; }
Looking over the code, we should return -1 directly here, goto end isn't going to provide more useful information as we don't have a "real" error code to tell the user. With that change please add:
and post v2, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200616/6eac488f/attachment.sig>