* [PATCH] fs: fat: fix build of the fuzz test without FS_FAT_LFN
@ 2026-11-19 8:40 Ahmad Fatoum
2026-11-24 7:04 ` Sascha Hauer
2026-11-24 7:05 ` Ahmad Fatoum
0 siblings, 2 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2026-11-19 8:40 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
From: Ahmad Fatoum <a.fatoum@barebox.org>
The lfname and lfsize members of FILINFO only exist with long file name
support, so guarding their use with IS_ENABLED() isn't enough and the
build fails with CONFIG_FS_FAT_LFN disabled.
Declare the buffer and assign the members in a single #ifdef block, and
zero-initialize the FILINFO per directory entry rather than memset() it.
Fixes: f585092b1737 ("fs: fat: add fuzz test for FAT filesystem")
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
fs/fat/fat.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 7ef879ebad41..96075e4f097a 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -408,12 +408,10 @@ static int fuzz_fat(struct block_device *ramdisk)
FATFS fat = {};
struct fat_priv priv = {};
FF_DIR dir;
- FILINFO finfo;
FIL fil;
BYTE buf[512];
UINT br;
int ret, i;
- char lfname[256];
priv.cdev = &ramdisk->cdev;
fat.userdata = &priv;
@@ -432,12 +430,14 @@ static int fuzz_fat(struct block_device *ramdisk)
* directory or a cyclic cluster chain.
*/
for (i = 0; i < 64; i++) {
- memset(&finfo, 0, sizeof(finfo));
+ FILINFO finfo = {};
- if (IS_ENABLED(CONFIG_FS_FAT_LFN)) {
- finfo.lfname = lfname;
- finfo.lfsize = sizeof(lfname);
- }
+#ifdef CONFIG_FS_FAT_LFN
+ char lfname[256];
+
+ finfo.lfname = lfname;
+ finfo.lfsize = sizeof(lfname);
+#endif
ret = f_readdir(&dir, &finfo);
if (ret || finfo.fname[0] == '\0')
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] fs: fat: fix build of the fuzz test without FS_FAT_LFN
2026-11-19 8:40 [PATCH] fs: fat: fix build of the fuzz test without FS_FAT_LFN Ahmad Fatoum
@ 2026-11-24 7:04 ` Sascha Hauer
2026-11-24 7:05 ` Ahmad Fatoum
1 sibling, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2026-11-24 7:04 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox, Ahmad Fatoum
On 2026-11-19 09:40, Ahmad Fatoum wrote:
> From: Ahmad Fatoum <a.fatoum@barebox.org>
>
> The lfname and lfsize members of FILINFO only exist with long file name
> support, so guarding their use with IS_ENABLED() isn't enough and the
> build fails with CONFIG_FS_FAT_LFN disabled.
>
> Declare the buffer and assign the members in a single #ifdef block, and
> zero-initialize the FILINFO per directory entry rather than memset() it.
>
> Fixes: f585092b1737 ("fs: fat: add fuzz test for FAT filesystem")
> Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
> ---
> fs/fat/fat.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
Already applied as 78244e2080 ("fs: fat: fix building without CONFIG_FS_FAT_LFN")
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] fs: fat: fix build of the fuzz test without FS_FAT_LFN
2026-11-19 8:40 [PATCH] fs: fat: fix build of the fuzz test without FS_FAT_LFN Ahmad Fatoum
2026-11-24 7:04 ` Sascha Hauer
@ 2026-11-24 7:05 ` Ahmad Fatoum
2026-11-24 7:26 ` Sascha Hauer
1 sibling, 1 reply; 4+ messages in thread
From: Ahmad Fatoum @ 2026-11-24 7:05 UTC (permalink / raw)
To: Ahmad Fatoum, barebox
On 11/19/26 09:40, Ahmad Fatoum wrote:
> From: Ahmad Fatoum <a.fatoum@barebox.org>
>
> The lfname and lfsize members of FILINFO only exist with long file name
> support, so guarding their use with IS_ENABLED() isn't enough and the
> build fails with CONFIG_FS_FAT_LFN disabled.
>
> Declare the buffer and assign the members in a single #ifdef block, and
> zero-initialize the FILINFO per directory entry rather than memset() it.
>
> Fixes: f585092b1737 ("fs: fat: add fuzz test for FAT filesystem")
> Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
Sascha's file system conformance series fixes the same issue with the difference
that this patch here gets away with a single #ifdef instead of two.
Both are fine by me, but I thought this to be a bit less of an eye sore.
Cheers,
Ahmad
> ---
> fs/fat/fat.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/fs/fat/fat.c b/fs/fat/fat.c
> index 7ef879ebad41..96075e4f097a 100644
> --- a/fs/fat/fat.c
> +++ b/fs/fat/fat.c
> @@ -408,12 +408,10 @@ static int fuzz_fat(struct block_device *ramdisk)
> FATFS fat = {};
> struct fat_priv priv = {};
> FF_DIR dir;
> - FILINFO finfo;
> FIL fil;
> BYTE buf[512];
> UINT br;
> int ret, i;
> - char lfname[256];
>
> priv.cdev = &ramdisk->cdev;
> fat.userdata = &priv;
> @@ -432,12 +430,14 @@ static int fuzz_fat(struct block_device *ramdisk)
> * directory or a cyclic cluster chain.
> */
> for (i = 0; i < 64; i++) {
> - memset(&finfo, 0, sizeof(finfo));
> + FILINFO finfo = {};
>
> - if (IS_ENABLED(CONFIG_FS_FAT_LFN)) {
> - finfo.lfname = lfname;
> - finfo.lfsize = sizeof(lfname);
> - }
> +#ifdef CONFIG_FS_FAT_LFN
> + char lfname[256];
> +
> + finfo.lfname = lfname;
> + finfo.lfsize = sizeof(lfname);
> +#endif
>
> ret = f_readdir(&dir, &finfo);
> if (ret || finfo.fname[0] == '\0')
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] fs: fat: fix build of the fuzz test without FS_FAT_LFN
2026-11-24 7:05 ` Ahmad Fatoum
@ 2026-11-24 7:26 ` Sascha Hauer
0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2026-11-24 7:26 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: Ahmad Fatoum, barebox
On 2026-11-24 08:05, Ahmad Fatoum wrote:
> On 11/19/26 09:40, Ahmad Fatoum wrote:
> > From: Ahmad Fatoum <a.fatoum@barebox.org>
> >
> > The lfname and lfsize members of FILINFO only exist with long file name
> > support, so guarding their use with IS_ENABLED() isn't enough and the
> > build fails with CONFIG_FS_FAT_LFN disabled.
> >
> > Declare the buffer and assign the members in a single #ifdef block, and
> > zero-initialize the FILINFO per directory entry rather than memset() it.
> >
> > Fixes: f585092b1737 ("fs: fat: add fuzz test for FAT filesystem")
> > Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
>
> Sascha's file system conformance series fixes the same issue with the difference
> that this patch here gets away with a single #ifdef instead of two.
>
> Both are fine by me, but I thought this to be a bit less of an eye sore.
Indeed. I added a follow up updating to your version.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-24 7:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 8:40 [PATCH] fs: fat: fix build of the fuzz test without FS_FAT_LFN Ahmad Fatoum
2026-11-24 7:04 ` Sascha Hauer
2026-11-24 7:05 ` Ahmad Fatoum
2026-11-24 7:26 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox