mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH] fs: fat: fix build of the fuzz test without FS_FAT_LFN
Date: Thu, 19 Nov 2026 09:40:26 +0100	[thread overview]
Message-ID: <20261119084042.2161333-1-a.fatoum@pengutronix.de> (raw)

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




                 reply	other threads:[~2026-11-19 10:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261119084042.2161333-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=a.fatoum@barebox.org \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox