| 635356e5 | 30-Sep-2017 |
Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> |
UPSTREAM: fs/fat: Check malloc return values and fix memory leaks
Check malloc() return values and properly unwind on errors so memory allocated for fat_itr structures get freed properly.
Also fixe
UPSTREAM: fs/fat: Check malloc return values and fix memory leaks
Check malloc() return values and properly unwind on errors so memory allocated for fat_itr structures get freed properly.
Also fixes a leak of fsdata.fatbuf in fat_size().
Fixes: 2460098cffacd1 ("fs/fat: Reduce stack usage") Change-Id: If2abd822a136b40375f6b0052c88c0d9deb3a632 Reported-by: Coverity (CID: 167225, 167233, 167234) Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Kever Yang <kever.yang@rock-chips.com> (cherry picked from commit af609e3764ea3ed7c0ccad8e57f9d9671c81c3e8)
show more ...
|
| 29de6c91 | 22-Sep-2017 |
Tom Rini <trini@konsulko.com> |
UPSTREAM: fs/fat: Reduce stack usage
We have limited stack in SPL builds. Drop itrblock and move to malloc/free of itr to move this off of the stack. As part of this fix a double-free issue in fat
UPSTREAM: fs/fat: Reduce stack usage
We have limited stack in SPL builds. Drop itrblock and move to malloc/free of itr to move this off of the stack. As part of this fix a double-free issue in fat_size().
Change-Id: I2d8baa3a0b6ffa0f9591366a095d5e315c41fde8 Signed-off-by: Tom Rini <trini@konsulko.com> --- Rework to use malloc/free as moving this to a global overflows some SH targets. Signed-off-by: Kever Yang <kever.yang@rock-chips.com> (cherry picked from commit 2460098cffacd18729262e3ed36656e6943783ed)
show more ...
|
| 85681a03 | 12-Sep-2017 |
Rob Clark <robdclark@gmail.com> |
UPSTREAM: fs/fat: fix fatbuf leak
A new fatbuf was allocated by get_fs_info() (called by fat_itr_root()), but not freed, resulting in eventually running out of memory. Spotted by running 'ls -r' in
UPSTREAM: fs/fat: fix fatbuf leak
A new fatbuf was allocated by get_fs_info() (called by fat_itr_root()), but not freed, resulting in eventually running out of memory. Spotted by running 'ls -r' in a large FAT filesystem from Shell.efi.
fatbuf is mainly used to cache FAT entry lookups (get_fatent()).. possibly once fat_write.c it can move into the iterator to simplify this.
Change-Id: I194a2de30a177e9b377dc50c61a2af6106dd8820 Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Łukasz Majewski <lukma@denx.de> Signed-off-by: Kever Yang <kever.yang@rock-chips.com> (cherry picked from commit 725ffdb5cbcc4b8a9726a68cc6ae0713266ba5a9)
show more ...
|
| 1d8c5dbb | 09-Sep-2017 |
Rob Clark <robdclark@gmail.com> |
UPSTREAM: fs/fat: Clean up open-coded sector <-> cluster conversions
Use the clust_to_sect() helper that was introduced earlier, and add an inverse sect_to_clust(), plus update the various spots tha
UPSTREAM: fs/fat: Clean up open-coded sector <-> cluster conversions
Use the clust_to_sect() helper that was introduced earlier, and add an inverse sect_to_clust(), plus update the various spots that open-coded this conversion previously.
Change-Id: Ifb6a59cefda1491639dcd6e8ea32fd2490af13b5 Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Kever Yang <kever.yang@rock-chips.com> (cherry picked from commit 265edc03d5a19550d92cbd6e10631d5a15bdd1d5)
show more ...
|
| 271eb208 | 09-Sep-2017 |
Rob Clark <robdclark@gmail.com> |
UPSTREAM: fs/fat: fix case for FAT shortnames
Noticed when comparing our output to linux. There are some lcase bits which control whether filename and/or extension should be downcase'd.
Change-Id:
UPSTREAM: fs/fat: fix case for FAT shortnames
Noticed when comparing our output to linux. There are some lcase bits which control whether filename and/or extension should be downcase'd.
Change-Id: I55dc1f9ef025dc3174158d06ed78d1f8b54e1335 Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Kever Yang <kever.yang@rock-chips.com> (cherry picked from commit 21a24c3bf35bac83d66ce4a48eb0c7dd8a7227cb)
show more ...
|
| d5fb8aea | 09-Sep-2017 |
Rob Clark <robdclark@gmail.com> |
UPSTREAM: fat/fs: move ls to generic implementation
Add a generic implementation of 'ls' using opendir/readdir/closedir, and replace fat's custom implementation. Other filesystems should move to th
UPSTREAM: fat/fs: move ls to generic implementation
Add a generic implementation of 'ls' using opendir/readdir/closedir, and replace fat's custom implementation. Other filesystems should move to the generic implementation after they add opendir/readdir/closedir support.
Change-Id: I287d3cd6e97c0c1901518c5ae1bb0653c7299f9b Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Łukasz Majewski <lukma@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Kever Yang <kever.yang@rock-chips.com> (cherry picked from commit 89191d626793490b579e1d36e7d7a4464a20f9f6)
show more ...
|
| 53ee50a1 | 09-Sep-2017 |
Rob Clark <robdclark@gmail.com> |
UPSTREAM: fat/fs: remove a bunch of dead code
Spotted by chance, when trying to remove file_fat_ls(), I noticed there were some dead users of the API.
Change-Id: Iab669e5f9fd3840dbf1d7ebf026c682777
UPSTREAM: fat/fs: remove a bunch of dead code
Spotted by chance, when trying to remove file_fat_ls(), I noticed there were some dead users of the API.
Change-Id: Iab669e5f9fd3840dbf1d7ebf026c6827775186ab Signed-off-by: Rob Clark <robdclark@gmail.com> Acked-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Kever Yang <kever.yang@rock-chips.com> (cherry picked from commit 41fa83d1a6cdd8ddfb3fbe332252193ff8fb8b71)
show more ...
|
| fed831fc | 09-Sep-2017 |
Rob Clark <robdclark@gmail.com> |
UPSTREAM: fs/fat: introduce new director iterators
Untangle directory traversal into a simple iterator, to replace the existing multi-purpose do_fat_read_at() + get_dentfromdir().
Change-Id: Iacf40
UPSTREAM: fs/fat: introduce new director iterators
Untangle directory traversal into a simple iterator, to replace the existing multi-purpose do_fat_read_at() + get_dentfromdir().
Change-Id: Iacf404e2ac7796adfa489d6e098c4d310635975a Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Łukasz Majewski <lukma@denx.de> Signed-off-by: Kever Yang <kever.yang@rock-chips.com> (cherry picked from commit c6e3baa565bc3b5828cf0d67ca6429dbe5f8687c)
show more ...
|
| 8d48c92b | 17-Dec-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
fs/fat: simplify get_fatent for FAT12
Instead of shuffling bits from two adjacent 16 bit words, use one 16 bit word with the appropriate byte offset in the buffer.
Signed-off-by: Stefan Brüns <stef
fs/fat: simplify get_fatent for FAT12
Instead of shuffling bits from two adjacent 16 bit words, use one 16 bit word with the appropriate byte offset in the buffer.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
show more ...
|
| b8948d2a | 16-Dec-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
fs/fat: merge readwrite get_fatent_value() with readonly get_fatent()
get_fatent_value(...) flushes changed FAT entries to disk when fetching the next FAT blocks, in every other aspect it is identic
fs/fat: merge readwrite get_fatent_value() with readonly get_fatent()
get_fatent_value(...) flushes changed FAT entries to disk when fetching the next FAT blocks, in every other aspect it is identical to get_fatent(...).
Provide a stub implementation for flush_dirty_fat_buffer if CONFIG_FAT_WRITE is not set. Calling flush_dirty_fat_buffer during read only operation is fine as it checks if any buffers needs flushing.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
show more ...
|
| 6c1a8080 | 16-Dec-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
fs/fat: Avoid corruption of sectors following the FAT
The FAT is read/flushed in segments of 6 (FATBUFBLOCKS) disk sectors. The last segment may be less than 6 sectors, cap the length.
Signed-off-b
fs/fat: Avoid corruption of sectors following the FAT
The FAT is read/flushed in segments of 6 (FATBUFBLOCKS) disk sectors. The last segment may be less than 6 sectors, cap the length.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
show more ...
|
| ae1755be | 11-Sep-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
fs/fat: Correct description of determine_fatent function
Current description does not match the function behaviour.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Lukasz Majew
fs/fat: Correct description of determine_fatent function
Current description does not match the function behaviour.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Lukasz Majewski <l.majewski@samsung.com>
show more ...
|