u-boot/fs
Jason Wessel 5b3ddb17ba fs/fat/fat.c: Do not perform zero block reads if there are no blocks left
While using u-boot with qemu's virtio driver I stumbled across a
problem reading files less than sector size.  On the real hardware the
block reader seems ok with reading zero blocks, and while we could fix
the virtio host side of qemu to deal with a zero block read instead of
crashing, the u-boot fat driver should not be doing zero block reads
in the first place.  If you ask hardware to read zero blocks you are
just going to get zero data.  There may also be other hardware that
responds similarly to the virtio interface so this is worth fixing.

Without the patch I get the following and have to restart qemu because
it dies.
---------------------------------
=> fatls virtio 0:1
       30   cmdline.txt
=> fatload virtio 0:1 ${loadaddr} cmdline.txt
qemu-system-aarch64: virtio: zero sized buffers are not allowed
---------------------------------

With the patch I get the expected results.
---------------------------------
=> fatls virtio 0:1
       30   cmdline.txt
=> fatload virtio 0:1 ${loadaddr} cmdline.txt
30 bytes read in 11 ms (2 KiB/s)
=> md.b ${loadaddr} 0x1E
40080000: 64 77 63 5f 6f 74 67 2e 6c 70 6d 5f 65 6e 61 62    dwc_otg.lpm_enab
40080010: 6c 65 3d 30 20 72 6f 6f 74 77 61 69 74 0a          le=0 rootwait.

---------------------------------

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2020-08-04 17:53:58 -04:00
..
btrfs common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
cbfs cbfs: Don't require the CBFS size with cbfs_init_mem() 2020-05-27 14:40:09 +08:00
cramfs common: Drop flash.h from common header 2020-05-18 14:53:28 -04:00
ext4 common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
fat fs/fat/fat.c: Do not perform zero block reads if there are no blocks left 2020-08-04 17:53:58 -04:00
jffs2 common: Drop flash.h from common header 2020-05-18 14:53:28 -04:00
reiserfs part: Drop disk_partition_t typedef 2020-05-18 17:33:33 -04:00
sandbox common: Drop part.h from common header 2020-05-18 17:33:33 -04:00
ubifs common: Drop linux/bitops.h from common header 2020-05-18 21:19:23 -04:00
yaffs2 common: Drop linux/bug.h from common header 2020-05-18 21:19:23 -04:00
zfs common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
fs.c fs: error handling in do_load() 2020-07-17 10:47:19 -04:00
fs_internal.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
Kconfig fs: btrfs: Add U-Boot fs handlers. 2017-10-02 21:52:18 -04:00
Makefile cbfs: Allow CBFS to be used in SPL 2019-08-18 21:54:10 +08:00