| #
6471ada5 |
| 04-Nov-2011 |
Wolfgang Denk <wd@denx.de> |
fs/fat/fat.c: Fix GCC 4.6 build warning
Fix: fat.c: In function 'fat_register_device': fat.c:74:19: warning: variable 'info' set but not used [-Wunused-but-set-variable]
Signed-off-by: Wolfgang Den
fs/fat/fat.c: Fix GCC 4.6 build warning
Fix: fat.c: In function 'fat_register_device': fat.c:74:19: warning: variable 'info' set but not used [-Wunused-but-set-variable]
Signed-off-by: Wolfgang Denk <wd@denx.de>
show more ...
|
| #
206d68fd |
| 19-Oct-2011 |
J. Vijayanand <vijayanand.jayaraman@in.bosch.com> |
fat: correct ATTR_VFAT check
ATTR_VFAT condition requires multiple bits to be set but the present condition checking in do_fat_read() & get_dentfromdir() ends up passing on even a single bit being s
fat: correct ATTR_VFAT check
ATTR_VFAT condition requires multiple bits to be set but the present condition checking in do_fat_read() & get_dentfromdir() ends up passing on even a single bit being set.
Signed-off-by: J. Vijayanand <vijayanand.jayaraman@in.bosch.com> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
show more ...
|
| #
e116cc06 |
| 27-Oct-2011 |
Wolfgang Denk <wd@denx.de> |
fs/fat/fat.c: fix warning: 'part_size' defined but not used
Commit c30a15e "FAT: Add FAT write feature" introduced a compiler warning. Fix this.
Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Dongg
fs/fat/fat.c: fix warning: 'part_size' defined but not used
Commit c30a15e "FAT: Add FAT write feature" introduced a compiler warning. Fix this.
Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Donggeun Kim <dg77.kim@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com>
show more ...
|
| #
c30a15e5 |
| 24-Oct-2011 |
Donggeun Kim <dg77.kim@samsung.com> |
FAT: Add FAT write feature
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 re
FAT: Add FAT write feature
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 <dg77.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
show more ...
|
| #
025421ea |
| 19-Aug-2011 |
Sergei Shtylyov <sshtylyov@ru.mvista.com> |
fat: replace LINEAR_PREFETCH_SIZE with PREFETCH_BLOCKS
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
fat: replace LINEAR_PREFETCH_SIZE with PREFETCH_BLOCKS
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 <sshtylyov@mvista.com>
show more ...
|
| #
40e21916 |
| 19-Aug-2011 |
Sergei Shtylyov <sshtylyov@ru.mvista.com> |
fat: root directory cluster only makes sense for FAT32
The root directory cluster field only exists in a FAT32 boot sector, so the 'root_cluster' variable in do_fat_read() contains garbage in case o
fat: root directory cluster only makes sense for FAT32
The root directory cluster field only exists in a FAT32 boot sector, so the 'root_cluster' variable in do_fat_read() contains garbage in case of FAT12/16. Make it contain 0 instead as this is what is passed to get_vfatname() in that case anyway.
Signed-off-by: Sergei Shtylyov <sshtylyov@mvista.com>
show more ...
|
| #
60b36f0f |
| 08-Aug-2011 |
Sergei Shtylyov <sshtylyov@ru.mvista.com> |
fat: cannot compare bytes and sectors
The code multiples the FAT size in sectors by the sector size and then tries to compare that to the number of sectors in the 'getsize' variable. While fixing t
fat: cannot compare bytes and sectors
The code multiples the FAT size in sectors by the sector size and then tries to compare that to the number of sectors in the 'getsize' variable. While fixing this, also change the initial value of 'getsize' as the division of FATBUFSIZE by the sector size gets us FATBUFBLOCKS.
Signed-off-by: Sergei Shtylyov <sshtylyov@mvista.com>
show more ...
|
| #
ac497771 |
| 08-Aug-2011 |
Sergei Shtylyov <sshtylyov@ru.mvista.com> |
fat: fix crash with big sector size
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
fat: fix crash with big sector size
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 <sshtylyov@mvista.com>
show more ...
|
| #
3f270f42 |
| 24-Mar-2011 |
Erik Hansen <erik@makarta.com> |
fat32 root directory handling
Fat directory handling didn't check reaching the end of the root directory. It relied on a stop condition based on a directory entry with a name starting with a '\0' ch
fat32 root directory handling
Fat directory handling didn't check reaching the end of the root directory. It relied on a stop condition based on a directory entry with a name starting with a '\0' character. This check in itself is wrong ('\0' indicates free entry, not end_of_directory) but outside the scope of this fix. For FAT32, the end of the rootdir is reached when the end of the cluster chain is reached. The code didn't check this condition and started to read an incorrect cluster. This caused a subsequent read request of a sector outside the range of the usb stick in use. On its turn, the usb stick protested with a stall handshake.
Both FAT32 and non-FAT32 (FAT16/FAT12) end or rootdir checks have been put in.
Signed-off-by: Erik Hansen <erik@makarta.com>
show more ...
|
| #
37a3bda0 |
| 02-Nov-2010 |
Minkyu Kang <mk7.kang@samsung.com> |
Merge branch 'master' of git://git.denx.de/u-boot-arm
|
| #
11c8dd36 |
| 20-Oct-2010 |
Stefano Babic <sbabic@denx.de> |
FAT: buffer overflow with FAT12/16
Last commit 3831530dcb7b71329c272ccd6181f8038b6a6dd0a was intended "explicitly specify FAT12/16 root directory parsing buffer size, instead of relying on cluster s
FAT: buffer overflow with FAT12/16
Last commit 3831530dcb7b71329c272ccd6181f8038b6a6dd0a was intended "explicitly specify FAT12/16 root directory parsing buffer size, instead of relying on cluster size". Howver, the underlying function requires the size of the buffer in blocks, not in bytes, and instead of passing a double sector size a request for 1024 blocks is sent. This generates a buffer overflow with overwriting of other structure (in the case seen, USB structures were overwritten).
Signed-off-by: Stefano Babic <sbabic@denx.de> CC: Mikhail Zolotaryov <lebon@lebon.org.ua>
show more ...
|
| #
3831530d |
| 08-Sep-2010 |
Mikhail Zolotaryov <lebon@lebon.org.ua> |
VFAT: fix processing of scattered long file name entries
The U-Boot code has the following bugs related to the processing of Long File Name (LFN) entries scattered across several clusters/sectors :
VFAT: fix processing of scattered long file name entries
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 <lebon@lebon.org.ua>
show more ...
|
| #
ac956293 |
| 03-Aug-2010 |
Wolfgang Denk <wd@denx.de> |
Merge branch 'master' of /home/wd/git/u-boot/master
|
| #
7385c28e |
| 19-Jul-2010 |
Wolfgang Denk <wd@denx.de> |
fs/fat: Big code cleanup.
- reformat - throw out macros like FAT_DPRINT and FAT_DPRINT - remove dead code
Signed-off-by: Wolfgang Denk <wd@denx.de>
|
| #
2aa98c66 |
| 19-Jul-2010 |
Wolfgang Denk <wd@denx.de> |
FAT32: fix broken root directory handling.
On FAT32, instead of fetching the cluster numbers from the FAT, the code assumed (incorrectly) that the clusters for the root directory were allocated cont
FAT32: fix broken root directory handling.
On FAT32, instead of fetching the cluster numbers from the FAT, the code assumed (incorrectly) that the clusters for the root directory were allocated contiguously. In the result, only the first cluster could be accessed. At the typical cluster size of 8 sectors this caused all accesses to files after the first 128 entries to fail - "fatls" would terminate after 128 files (usually displaying a bogus file name, occasionally even crashing the system), and "fatload" would fail to find any files that were not in the first directory cluster.
Signed-off-by: Wolfgang Denk <wd@denx.de>
show more ...
|
| #
66c2d73c |
| 19-Jul-2010 |
Wolfgang Denk <wd@denx.de> |
FAT32: fix support for superfloppy-format (PBR)
"Superfloppy" format (in U-Boot called PBR) did not work for FAT32 as the file system type string is at a different location. Add support for FAT32.
FAT32: fix support for superfloppy-format (PBR)
"Superfloppy" format (in U-Boot called PBR) did not work for FAT32 as the file system type string is at a different location. Add support for FAT32.
Signed-off-by: Wolfgang Denk <wd@denx.de>
show more ...
|
| #
2271d3dd |
| 06-Jul-2010 |
Minkyu Kang <mk7.kang@samsung.com> |
Merge branch 'master' of git://git.denx.de/u-boot
|
| #
bd7bb6f8 |
| 28-May-2010 |
Wolfgang Denk <wd@denx.de> |
Merge branch 'next' of git://git.denx.de/u-boot-nios
|
| #
1117cbf2 |
| 28-May-2010 |
Thomas Chou <thomas@wytron.com.tw> |
nios: remove nios-32 arch
The nios-32 arch is obsolete and broken. So it is removed.
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
|
| #
92afd368 |
| 14-Jun-2009 |
Wolfgang Denk <wd@denx.de> |
Merge branch 'next' of ../master
|
| #
651351fe |
| 20-May-2009 |
Tom Rix <Tom.Rix@windriver.com> |
FAT replace compare_sign with strncmp.
The static function compare_sign is only used to compare the fs_type string and does not do anything more than what strncmp does.
The addition of the trailing
FAT replace compare_sign with strncmp.
The static function compare_sign is only used to compare the fs_type string and does not do anything more than what strncmp does.
The addition of the trailing '\0' to fs_type, while legal, is not needed because the it is never printed out and strncmp does not depend on NULL terminated strings.
Signed-off-by: Tom Rix <Tom.Rix@windriver.com>
show more ...
|
| #
75eb82ec |
| 25-Feb-2009 |
unsik Kim <donari75@gmail.com> |
mflash: Initial mflash support
Mflash is fusion memory device mainly targeted consumer eletronic and mobile phone. Internally, it have nand flash and other hardware logics and supports some differen
mflash: Initial mflash support
Mflash is fusion memory device mainly targeted consumer eletronic and mobile phone. Internally, it have nand flash and other hardware logics and supports some different operation (ATA, IO, XIP) modes.
IO mode is custom mode for the host that doesn't have IDE interface. (Many mobile targeted SoC doesn't have IDE bus)
This driver support mflash IO mode.
Followings are brief descriptions about IO mode.
1. IO mode based on ATA protocol and uses some custom command. (read confirm, write confirm) 2. IO mode uses SRAM bus interface.
Signed-off-by: unsik Kim <donari75@gmail.com>
show more ...
|
| #
65f7d410 |
| 27-Jan-2009 |
Wolfgang Denk <wd@denx.de> |
fat.c: fix warning: array subscript is above array bounds
Fix based on suggestion by David Hawkins <dwh@ovro.caltech.edu>.
Signed-off-by: Wolfgang Denk <wd@denx.de>
|
| #
ef29884b |
| 25-Jan-2009 |
Ben Warren <biggerbadderben@gmail.com> |
Merge git://git.denx.de/u-boot into u-boot
|
| #
7e4b9b4f |
| 03-Jan-2009 |
Bryan Wu <bryan.wu@analog.com> |
fat: fix unaligned errors
A couple of buffers in the fat code are declared as an array of bytes. But it is then cast up to a structure with 16bit and 32bit members. Since GCC assumes structure align
fat: fix unaligned errors
A couple of buffers in the fat code are declared as an array of bytes. But it is then cast up to a structure with 16bit and 32bit members. Since GCC assumes structure alignment here, we have to force the buffers to be aligned according to the structure usage.
Signed-off-by: Bryan Wu <bryan.wu@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
show more ...
|