From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 1/2] filetype: fix MBR detection
Date: Mon, 24 Mar 2025 11:24:41 +0100 [thread overview]
Message-ID: <20250324102442.1750715-1-s.hauer@pengutronix.de> (raw)
is_fat_or_mbr() doesn't detect MBRs anymore because we return
filetype_unknown when it's not a FAT filesystem. Instead we may only
return early when it's explicitly a FAT filesystem, but continue
in the function in case it's not to properly detect a MBR.
Fixes: b25680a9c9 ("filetype: add file_detect_fs_type()")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/filetype.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/common/filetype.c b/common/filetype.c
index ce868223d5..80e6ceb845 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -243,9 +243,12 @@ enum filetype is_fat_or_mbr(const unsigned char *sector, unsigned long *bootsec)
if (bootsec)
*bootsec = 0;
- if (file_detect_fs_fat(sector, 512) != filetype_fat)
+ if (get_unaligned_le16(§or[BS_55AA]) != 0xAA55)
return filetype_unknown;
+ if (file_detect_fs_fat(sector, 512) == filetype_fat)
+ return filetype_fat;
+
if (bootsec)
/*
* This must be an MBR, so return the starting sector of the
--
2.39.5
next reply other threads:[~2025-03-24 10:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-24 10:24 Sascha Hauer [this message]
2025-03-24 10:24 ` [PATCH 2/2] filetype: fix FILETYPE_STRING misspelling Sascha Hauer
2025-03-25 7:16 ` [PATCH 1/2] filetype: fix MBR detection Sascha Hauer
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=20250324102442.1750715-1-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--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