<feed xmlns='http://www.w3.org/2005/Atom'>
<title>u-boot.git/include/fat.h, branch v2012.07</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/'/>
<entry>
<title>fat: fix FAT sector offsets overflow on large FAT partitions</title>
<updated>2012-05-22T08:14:05+00:00</updated>
<author>
<name>Aaron Williams</name>
<email>aaron.williams@caviumnetworks.com</email>
</author>
<published>2012-05-19T07:20:40+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=1d90c3b457a64aa339aa900199e519ff08440778'/>
<id>1d90c3b457a64aa339aa900199e519ff08440778</id>
<content type='text'>
This patch fixes several issues where sector offsets can overflow due
to being limited to 16-bits. The cases where an overflow can happen
when accessing large FAT32 partitions are:

 - length of FAT in sectors
 - start sector of root directory
 - the sector of the first cluster

These issues were observed when reading files from a 64GB FAT32
filesystem.

Signed-off-by: Aaron Williams &lt;aaron.williams@caviumnetworks.com&gt;
Tested-by: Anatolij Gustschin &lt;agust@denx.de&gt;
Signed-off-by: Anatolij Gustschin &lt;agust@denx.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch fixes several issues where sector offsets can overflow due
to being limited to 16-bits. The cases where an overflow can happen
when accessing large FAT32 partitions are:

 - length of FAT in sectors
 - start sector of root directory
 - the sector of the first cluster

These issues were observed when reading files from a 64GB FAT32
filesystem.

Signed-off-by: Aaron Williams &lt;aaron.williams@caviumnetworks.com&gt;
Tested-by: Anatolij Gustschin &lt;agust@denx.de&gt;
Signed-off-by: Anatolij Gustschin &lt;agust@denx.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>FAT: Add FAT write feature</title>
<updated>2011-10-26T19:40:44+00:00</updated>
<author>
<name>Donggeun Kim</name>
<email>dg77.kim@samsung.com</email>
</author>
<published>2011-10-24T21:15:28+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=c30a15e590c7e5bfd27e4704c81648071f11d51f'/>
<id>c30a15e590c7e5bfd27e4704c81648071f11d51f</id>
<content type='text'>
In some cases, saving data in RAM as a file with FAT format is required.
This patch allows the file to be written in FAT formatted partition.

The usage is similar with reading a file.
First, fat_register_device function is called before file_fat_write function
in order to set target partition.
Then, file_fat_write function is invoked with desired file name,
start ram address for writing data, and file size.

Signed-off-by: Donggeun Kim &lt;dg77.kim@samsung.com&gt;
Signed-off-by: Kyungmin Park &lt;kyungmin.park@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In some cases, saving data in RAM as a file with FAT format is required.
This patch allows the file to be written in FAT formatted partition.

The usage is similar with reading a file.
First, fat_register_device function is called before file_fat_write function
in order to set target partition.
Then, file_fat_write function is invoked with desired file name,
start ram address for writing data, and file size.

Signed-off-by: Donggeun Kim &lt;dg77.kim@samsung.com&gt;
Signed-off-by: Kyungmin Park &lt;kyungmin.park@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fat: replace LINEAR_PREFETCH_SIZE with PREFETCH_BLOCKS</title>
<updated>2011-10-01T19:52:19+00:00</updated>
<author>
<name>Sergei Shtylyov</name>
<email>sshtylyov@ru.mvista.com</email>
</author>
<published>2011-08-19T09:37:46+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=025421eab453fd41a3cc14a0fc48115b0dc4c287'/>
<id>025421eab453fd41a3cc14a0fc48115b0dc4c287</id>
<content type='text'>
Currently in do_fat_read() when reading FAT sectors, we have to divide down
LINEAR_PREFETCH_SIZE by the sector size, whereas it's defined as 2 sectors
worth of bytes. In order to avoid redundant multiplication/division, introduce
#define PREFETCH_BLOCKS instead of #define LINEAR_PREFETCH_SIZE.

Signed-off-by: Sergei Shtylyov &lt;sshtylyov@mvista.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently in do_fat_read() when reading FAT sectors, we have to divide down
LINEAR_PREFETCH_SIZE by the sector size, whereas it's defined as 2 sectors
worth of bytes. In order to avoid redundant multiplication/division, introduce
#define PREFETCH_BLOCKS instead of #define LINEAR_PREFETCH_SIZE.

Signed-off-by: Sergei Shtylyov &lt;sshtylyov@mvista.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fat: fix crash with big sector size</title>
<updated>2011-10-01T19:50:39+00:00</updated>
<author>
<name>Sergei Shtylyov</name>
<email>sshtylyov@ru.mvista.com</email>
</author>
<published>2011-08-08T09:38:33+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=ac4977719e157bcb3c45c70d9dd781164727530d'/>
<id>ac4977719e157bcb3c45c70d9dd781164727530d</id>
<content type='text'>
Apple iPod nanos have sector sizes of 2 or 4 KiB, which crashes U-Boot when it
tries to read the boot sector into 512-byte buffer situated on stack. Make the
FAT code indifferent to the sector size.

Signed-off-by: Sergei Shtylyov &lt;sshtylyov@mvista.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Apple iPod nanos have sector sizes of 2 or 4 KiB, which crashes U-Boot when it
tries to read the boot sector into 512-byte buffer situated on stack. Make the
FAT code indifferent to the sector size.

Signed-off-by: Sergei Shtylyov &lt;sshtylyov@mvista.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>VFAT: fix processing of scattered long file name entries</title>
<updated>2010-10-12T20:39:14+00:00</updated>
<author>
<name>Mikhail Zolotaryov</name>
<email>lebon@lebon.org.ua</email>
</author>
<published>2010-09-08T14:06:03+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=3831530dcb7b71329c272ccd6181f8038b6a6dd0'/>
<id>3831530dcb7b71329c272ccd6181f8038b6a6dd0</id>
<content type='text'>
The U-Boot code has the following bugs related to the processing of Long File
Name (LFN) entries scattered across several clusters/sectors :

1) get_vfatname() function is designed to gather scattered LFN entries by
cluster chain processing - that doesn't work for FAT12/16 root directory.
In other words, the function expects the following input data:
 1.1) FAT32 directory (which is cluster chain based);
        OR
 1.2) FAT12/16 non-root directory (which is also cluster chain based);
        OR
 1.3) FAT12/16 root directory (allocated as contiguous sectors area), but
 all necessary information MUST be within the input buffer of filesystem cluster
 size (thus cluster-chain jump is never initiated).

In order to accomplish the last condition, root directory parsing code in
do_fat_read() uses the following trick: read-out cluster-size block, process
only first sector (512 bytes), then shift 512 forward, read-out cluster-size
block and so on. This works great unless cluster size is equal to 512 bytes
(in a case you have a small partition), or long file name entries are scattered
across three sectors, see 4) for details.

2) Despite of the fact that get_vfatname() supports FAT32 root directory
browsing, do_fat_read() function doesn't send current cluster number correctly,
so root directory look-up doesn't work correctly.

3) get_vfatname() doesn't gather scattered entries correctly also is the case
when all LFN entries are located at the end of the source cluster, but real
directory entry (which must be returned) is at the only beginning of the
next one. No error detected, the resulting directory entry returned contains
a semi-random information (wrong size, wrong start cluster number and so on)
i.e. the entry is not accessible.

4) LFN (VFAT) allows up to 20 entries (slots) each containing 26 bytes (13
UTF-16 code units) to represent a single long file name i.e. up to 520 bytes.
U-Boot allocates 256 bytes buffer instead, i.e. 10 or more LFN slots record
may cause buffer overflow / memory corruption.
Also, it's worth to mention that 20+1 slots occupy 672 bytes space which may
take more than one cluster of 512 bytes (medium-size FAT32 or small FAT16
partition) - get_vfatname() function doesn't support such case as well.

The patch attached fixes these problems in the following way:
- keep using 256 bytes buffer for a long file name, but safely prevent a
possible buffer overflow (skip LFN processing, if it contains 10 or more
slots).

- explicitly specify FAT12/16 root directory parsing buffer size, instead
of relying on cluster size. The value used is a double sector size (to store
current sector and the next one). This fixes the first problem and increases
performance on big FAT12/16 partitions;

- send current cluster number (FAT32) to get_vfatname() during root
directory processing;

- use LFN counter to seek the real directory entry in get_vfatname() - fixes the
third problem;

- skip deleted entries in the root directory (to prevent bogus buffer
overflow detection and LFN counter steps).

Note: it's not advised to split up the patch, because a separate part may
operate incorrectly.

Signed-off-by: Mikhail Zolotaryov &lt;lebon@lebon.org.ua&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The U-Boot code has the following bugs related to the processing of Long File
Name (LFN) entries scattered across several clusters/sectors :

1) get_vfatname() function is designed to gather scattered LFN entries by
cluster chain processing - that doesn't work for FAT12/16 root directory.
In other words, the function expects the following input data:
 1.1) FAT32 directory (which is cluster chain based);
        OR
 1.2) FAT12/16 non-root directory (which is also cluster chain based);
        OR
 1.3) FAT12/16 root directory (allocated as contiguous sectors area), but
 all necessary information MUST be within the input buffer of filesystem cluster
 size (thus cluster-chain jump is never initiated).

In order to accomplish the last condition, root directory parsing code in
do_fat_read() uses the following trick: read-out cluster-size block, process
only first sector (512 bytes), then shift 512 forward, read-out cluster-size
block and so on. This works great unless cluster size is equal to 512 bytes
(in a case you have a small partition), or long file name entries are scattered
across three sectors, see 4) for details.

2) Despite of the fact that get_vfatname() supports FAT32 root directory
browsing, do_fat_read() function doesn't send current cluster number correctly,
so root directory look-up doesn't work correctly.

3) get_vfatname() doesn't gather scattered entries correctly also is the case
when all LFN entries are located at the end of the source cluster, but real
directory entry (which must be returned) is at the only beginning of the
next one. No error detected, the resulting directory entry returned contains
a semi-random information (wrong size, wrong start cluster number and so on)
i.e. the entry is not accessible.

4) LFN (VFAT) allows up to 20 entries (slots) each containing 26 bytes (13
UTF-16 code units) to represent a single long file name i.e. up to 520 bytes.
U-Boot allocates 256 bytes buffer instead, i.e. 10 or more LFN slots record
may cause buffer overflow / memory corruption.
Also, it's worth to mention that 20+1 slots occupy 672 bytes space which may
take more than one cluster of 512 bytes (medium-size FAT32 or small FAT16
partition) - get_vfatname() function doesn't support such case as well.

The patch attached fixes these problems in the following way:
- keep using 256 bytes buffer for a long file name, but safely prevent a
possible buffer overflow (skip LFN processing, if it contains 10 or more
slots).

- explicitly specify FAT12/16 root directory parsing buffer size, instead
of relying on cluster size. The value used is a double sector size (to store
current sector and the next one). This fixes the first problem and increases
performance on big FAT12/16 partitions;

- send current cluster number (FAT32) to get_vfatname() during root
directory processing;

- use LFN counter to seek the real directory entry in get_vfatname() - fixes the
third problem;

- skip deleted entries in the root directory (to prevent bogus buffer
overflow detection and LFN counter steps).

Note: it's not advised to split up the patch, because a separate part may
operate incorrectly.

Signed-off-by: Mikhail Zolotaryov &lt;lebon@lebon.org.ua&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fs/fat: Big code cleanup.</title>
<updated>2010-07-24T18:54:46+00:00</updated>
<author>
<name>Wolfgang Denk</name>
<email>wd@denx.de</email>
</author>
<published>2010-07-19T09:37:00+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=7385c28e9b5f7d47e6a8f1ad9800e6e70af714e2'/>
<id>7385c28e9b5f7d47e6a8f1ad9800e6e70af714e2</id>
<content type='text'>
- reformat
- throw out macros like FAT_DPRINT and FAT_DPRINT
- remove dead code

Signed-off-by: Wolfgang Denk &lt;wd@denx.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- reformat
- throw out macros like FAT_DPRINT and FAT_DPRINT
- remove dead code

Signed-off-by: Wolfgang Denk &lt;wd@denx.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove non-ascii characters from fat code</title>
<updated>2008-12-04T19:51:44+00:00</updated>
<author>
<name>Remy Bohmer</name>
<email>linux@bohmer.net</email>
</author>
<published>2008-11-27T21:30:27+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=3c2c2f427905040c1513d0c51d637689cba48346'/>
<id>3c2c2f427905040c1513d0c51d637689cba48346</id>
<content type='text'>
This code contains some non-ascii characters in comment lines and code.
Most editors do not display those characters properly and editing those
files results always in diffs at these places which are usually not required
to be changed at all. This is error prone.

So, remove those weird characters and replace them by normal C-style
equivalents for which the proper defines were already in the header.

Signed-off-by: Remy Bohmer &lt;linux@bohmer.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This code contains some non-ascii characters in comment lines and code.
Most editors do not display those characters properly and editing those
files results always in diffs at these places which are usually not required
to be changed at all. This is error prone.

So, remove those weird characters and replace them by normal C-style
equivalents for which the proper defines were already in the header.

Signed-off-by: Remy Bohmer &lt;linux@bohmer.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Big white-space cleanup.</title>
<updated>2008-05-20T22:14:08+00:00</updated>
<author>
<name>Wolfgang Denk</name>
<email>wd@denx.de</email>
</author>
<published>2008-05-20T14:00:29+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=53677ef18e25c97ac613349087c5cb33ae5a2741'/>
<id>53677ef18e25c97ac613349087c5cb33ae5a2741</id>
<content type='text'>
This commit gets rid of a huge amount of silly white-space issues.
Especially, all sequences of SPACEs followed by TAB characters get
removed (unless they appear in print statements).

Also remove all embedded "vim:" and "vi:" statements which hide
indentation problems.

Signed-off-by: Wolfgang Denk &lt;wd@denx.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit gets rid of a huge amount of silly white-space issues.
Especially, all sequences of SPACEs followed by TAB characters get
removed (unless they appear in print statements).

Also remove all embedded "vim:" and "vi:" statements which hide
indentation problems.

Signed-off-by: Wolfgang Denk &lt;wd@denx.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix checking fat32 cluster size.</title>
<updated>2008-03-02T23:40:42+00:00</updated>
<author>
<name>michael</name>
<email>trimarchi@gandalf.sssup.it</email>
</author>
<published>2008-03-02T22:33:46+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=8ce4e5c2c02cb7e8adddf7b651d3050d81ce4c1d'/>
<id>8ce4e5c2c02cb7e8adddf7b651d3050d81ce4c1d</id>
<content type='text'>
This fixes the cluster size tests in the FAT32 file system.
The current implementation of VFAT support doesn't work if the
referred cluster has an offset &gt; 16bit representation, causing
"fatload" and "fatls" commands etc. to fail.

Signed-off-by: michael trimarchi &lt;trimarchi@gandalf.sssup.it&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This fixes the cluster size tests in the FAT32 file system.
The current implementation of VFAT support doesn't work if the
referred cluster has an offset &gt; 16bit representation, causing
"fatload" and "fatls" commands etc. to fail.

Signed-off-by: michael trimarchi &lt;trimarchi@gandalf.sssup.it&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix fatload command on FAT32 formatted partitions.</title>
<updated>2006-08-14T20:05:26+00:00</updated>
<author>
<name>Wolfgang Denk</name>
<email>wd@fifi.denx.de</email>
</author>
<published>2006-08-14T20:05:26+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=80f0c0f58f6a39f893101d14a79169504e3c93fd'/>
<id>80f0c0f58f6a39f893101d14a79169504e3c93fd</id>
<content type='text'>
Patch by Joachim Jaeger, 18 Nov 2005
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Patch by Joachim Jaeger, 18 Nov 2005
</pre>
</div>
</content>
</entry>
</feed>
