mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vojtech Pavlik <vojtech@suse.cz>
To: linux-kernel@vger.kernel.org
Subject: [patch] Fix too stricts sanity checks in FATfs
Date: Thu, 23 Sep 2004 17:00:16 +0200	[thread overview]
Message-ID: <20040923150016.GA3167@ucw.cz> (raw)


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

                 reply	other threads:[~2004-09-23 15:01 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=20040923150016.GA3167@ucw.cz \
    --to=vojtech@suse.cz \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®