fs: fat: check for buffer size before reading blocks
authorRicardo Salveti <ricardo@foundries.io>
Sun, 26 Sep 2021 18:36:04 +0000 (21:36 +0300)
committerTom Rini <trini@konsulko.com>
Tue, 12 Oct 2021 20:49:21 +0000 (16:49 -0400)
commit41130eb8937e43b2307fb67ebb60f0190fc01438
treeb5e6473d4c10c563ef3659b55968311a8737723c
parent0892a7e5fa5ce38f58e0e6636ae56c6f60c080e0
fs: fat: check for buffer size before reading blocks

This patch optimizes the commit mentioned below by avoiding running
a set of commands which are useless in the case when
size < mydata->sect_size and sect_count would be 0.

Fixes: 5b3ddb17ba ("fs/fat/fat.c: Do not perform zero block reads if there are no blocks left")

Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Co-developed-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
fs/fat/fat.c