Re: [mmotm:master 174/212] fs///fat/inode.c:163:9: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'sector_t {aka long long unsigned int}'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



kbuild test robot <lkp@xxxxxxxxx> writes:

> tree:   git://git.cmpxchg.org/linux-mmotm.git master
> head:   7393732bae530daa27567988b91d16ecfeef6c62
> commit: fe3e5c4f07cde4be67152518d21429bfbb875c0c [174/212] fat: use fat_fs_error() instead of BUG_ON() in __fat_get_block()
> config: i386-randconfig-s0-201822-CONFIG_DEBUG_INFO_REDUCED (attached as .config)
> compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
> reproduce:
>         git checkout fe3e5c4f07cde4be67152518d21429bfbb875c0c
>         # save the attached .config to linux build tree
>         make ARCH=i386 
>
> All warnings (new ones prefixed by >>):
>
>    In file included from fs///fat/inode.c:24:0:
>    fs///fat/inode.c: In function '__fat_get_block':
>>> fs///fat/inode.c:163:9: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'sector_t {aka long long unsigned int}' [-Wformat=]
>             "invalid FAT chain (i_pos %lld, last_block %ld)",
>             ^
>    fs///fat/fat.h:397:24: note: in definition of macro 'fat_fs_error'
>      __fat_fs_error(sb, 1, fmt , ## args)

This is the updated patch to fix this warning. Please update

	fat-use-fat_fs_error-instead-of-bug_on-in-__fat_get_block.patch

Thanks.
-- 
OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>


[PATCH] fat: Use fat_fs_error() instead of BUG_ON() in __fat_get_block()

If file size and FAT cluster chain is not matched (corrupted image),
we can hit BUG_ON(!phys) in __fat_get_block().

So, use fat_fs_error() instead.

Link: http://lkml.kernel.org/r/874lilcu67.fsf@xxxxxxxxxxxxxxxxxx
Signed-off-by: OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>
Reported-by: Anatoly Trosinenko <anatoly.trosinenko@xxxxxxxxx>
Tested-by: Anatoly Trosinenko <anatoly.trosinenko@xxxxxxxxx>
---

 fs/fat/inode.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff -puN fs/fat/inode.c~vfat-dont-bugon fs/fat/inode.c
--- linux/fs/fat/inode.c~vfat-dont-bugon	2018-06-02 20:15:04.441920069 +0900
+++ linux-hirofumi/fs/fat/inode.c	2018-06-08 12:38:09.891123649 +0900
@@ -158,8 +158,14 @@ static inline int __fat_get_block(struct
 	err = fat_bmap(inode, iblock, &phys, &mapped_blocks, create, false);
 	if (err)
 		return err;
+	if (!phys) {
+		fat_fs_error(sb,
+			     "invalid FAT chain (i_pos %lld, last_block %llu)",
+			     MSDOS_I(inode)->i_pos,
+			     (unsigned long long)last_block);
+		return -EIO;
+	}
 
-	BUG_ON(!phys);
 	BUG_ON(*max_blocks != mapped_blocks);
 	set_buffer_new(bh_result);
 	map_bh(bh_result, sb, phys);
_




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux