From: Seung-Woo Kim Date: Mon, 4 Jun 2018 11:45:54 +0000 (+0900) Subject: fs: fat: fix wrong casting to unsigned value of sect_to_cluster() X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=6e2151c729674aecabf5ec5a96dac97433632009;p=u-boot.git fs: fat: fix wrong casting to unsigned value of sect_to_cluster() After the commit 265edc03d5a1 ("fs/fat: Clean up open-coded sector <-> cluster conversions"), it is hung up writing new file to FAT16 disk with more than 19 files in armv7. It is because result value of sect_to_cluster() is not proper by casting from signed value to unsigned value. Fix the wrong casting of sect_to_cluster(). Reported-by: Jaehoon Chung Signed-off-by: Seung-Woo Kim Reviewed-by: Lukasz Majewski --- diff --git a/include/fat.h b/include/fat.h index 7dada411e5..09e1423685 100644 --- a/include/fat.h +++ b/include/fat.h @@ -180,7 +180,7 @@ static inline u32 clust_to_sect(fsdata *fsdata, u32 clust) return fsdata->data_begin + clust * fsdata->clust_size; } -static inline u32 sect_to_clust(fsdata *fsdata, u32 sect) +static inline u32 sect_to_clust(fsdata *fsdata, int sect) { return (sect - fsdata->data_begin) / fsdata->clust_size; }