fat: fix sector print
PATCH 1/1 fat: fix sector print
Printing a sector_t using %ld fails when that is a 64-bit type on 32-bit architectures:
fs/fat/inode.c: In function '__fat_get_block':fs/fat/inode.c:163:9: error: format '%ld' expects argument of type 'long int', but argument 5 has type 'sector_t' {aka 'long long unsigned int'} [-Werror=format=]
"invalid FAT chain (i_pos %lld, last_block %ld)",
The common workaround is to cast the number to a 64-bit type and print that as %lld, that works in all configurations.
Fixes mmotm ("fat: use fat_fs_error() instead of BUG_ON() in __fat_get_block()")
Signed-off-by Arnd Bergmann <[email protected]>
--- fs/fat/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/fat/inode.c +2 -2
@@ -160,8 +160,8 @@ static inline int __fat_get_block(struct inode *inode, sector_t iblock,return err;if (!phys) {fat_fs_error (sb, -"invalid FAT chain (i_pos %lld, last_block %ld)" , -MSDOS_I (inode)->i_pos, last_block); +"invalid FAT chain (i_pos %lld, last_block %llu)" , +MSDOS_I (inode)->i_pos, (u64 )last_block);return -EIO ; }
Signature · 1 line
2.9.0