All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [U-Boot, v2] fs: fat: fix reading non-cluster-aligned root directory
Date: Wed, 10 Apr 2019 08:20:19 -0400	[thread overview]
Message-ID: <20190410122019.GL4664@bill-the-cat> (raw)
In-Reply-To: <20190227105557.20908-1-anssi.hannula@bitwise.fi>

On Wed, Feb 27, 2019 at 12:55:57PM +0200, Anssi Hannula wrote:

> A FAT12/FAT16 root directory location is specified by a sector offset and
> it might not start at a cluster boundary. It also resides before the
> data area (before cluster 2).
> 
> However, the current code assumes that the root directory is located at
> a beginning of a cluster, causing no files to be found if that is not
> the case.
> 
> Since the FAT12/FAT16 root directory is located before the data area
> and is not aligned to clusters, using unsigned cluster numbers to refer
> to the root directory does not work well (the "cluster number" may be
> negative, and even allowing it be signed would not make it properly
> aligned).
> 
> Modify the code to not use the normal cluster numbering when referring to
> the root directory of FAT12/FAT16 and instead use a cluster-sized
> offsets counted from the root directory start sector.
> 
> This is a relatively common case as at least the filesystem formatter on
> Win7 seems to create such filesystems by default on 2GB USB sticks when
> "FAT" is selected (cluster size 64 sectors, rootdir size 32 sectors,
> rootdir starts at half a cluster before cluster 2).
> 
> dosfstools mkfs.vfat does not seem to create affected filesystems.
> 
> Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi>
> Reviewed-by: Bernhard Messerklinger <bernhard.messerklinger@br-automation.com>
> Tested-by: Bernhard Messerklinger <bernhard.messerklinger@br-automation.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190410/5d90ca25/attachment.sig>

      parent reply	other threads:[~2019-04-10 12:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-06 18:02 [U-Boot] [PATCH] fs: fat: fix reading non-cluster-aligned root directory Anssi Hannula
2018-11-08 12:19 ` [U-Boot] Antwort: " Bernhard Messerklinger
2019-02-27 10:55   ` [U-Boot] [PATCH v2] " Anssi Hannula
2019-03-25  5:38     ` [U-Boot] Antwort: " Bernhard Messerklinger
2019-04-10 12:20     ` Tom Rini [this message]

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=20190410122019.GL4664@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.