mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch] Fix too stricts sanity checks in FATfs
@ 2004-09-23 15:00 Vojtech Pavlik
  0 siblings, 0 replies; only message in thread
From: Vojtech Pavlik @ 2004-09-23 15:00 UTC (permalink / raw)
  To: linux-kernel


This patch fixes a too strict sanity check in the FAT code, allowing
to mount the flash memory in Nokia phones, as well as in several
other devices.

The FAT standard allows for the first entries to be -1 to -8 in the
n-bit encoding, however Linux currently insists on -1 only.

--- linus/fs/fat/inode.c	2004-08-25 11:34:17.665758665 +0200
+++ input/fs/fat/inode.c	2004-08-25 11:23:47.000000000 +0200
@@ -999,11 +999,12 @@
 		error = first;
 		goto out_fail;
 	}
-	if (FAT_FIRST_ENT(sb, media) == first) {
-		/* all is as it should be */
-	} else if (media == 0xf8 && FAT_FIRST_ENT(sb, 0xfe) == first) {
+
+	if ((FAT_FIRST_ENT(sb, media) | 0x03) == first) {
+		/* all is as it should be: -1 to -8 */
+	} else if (media == 0xf8 && (FAT_FIRST_ENT(sb, 0xfe) | 0x03) == first) {
 		/* bad, reported on pc9800 */
-	} else if (media == 0xf0 && FAT_FIRST_ENT(sb, 0xf8) == first) {
+	} else if (media == 0xf0 && (FAT_FIRST_ENT(sb, 0xf8) | 0x03) == first) {
 		/* bad, reported with a MO disk on win95/me */
 	} else if (first == 0) {
 		/* bad, reported with a SmartMedia card */

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-09-23 15:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-23 15:00 [patch] Fix too stricts sanity checks in FATfs Vojtech Pavlik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®