All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] f2fs: fix sanity_check_raw_super on big endian machines
@ 2018-12-21 19:28 Martin Blumenstingl
  2018-12-21 19:28 ` [PATCH 1/1] f2fs: fix validation of the block count in sanity_check_raw_super Martin Blumenstingl
  0 siblings, 1 reply; 12+ messages in thread
From: Martin Blumenstingl @ 2018-12-21 19:28 UTC (permalink / raw)
  To: linux-f2fs-devel, yuchao0, jaegeuk
  Cc: linux-kernel, stable, Martin Blumenstingl

Big endian machines (at least the one I have access to) cannot mount
f2fs filesystems anymore.
This is with Linux 4.14.89 but I suspect that 4.9.144 (and later) is
affected as well.

commit 0cfe75c5b01199 ("f2fs: enhance sanity_check_raw_super() to avoid
potential overflows") treats the "block_count" from struct
f2fs_super_block as 32-bit little endian value instead of a 64-bit
little endian value.

I tested this fix on top of Linux 4.14.49 but it seems that all stable
and mainline kernel versions are affected:
- 4.9.144 and later because 0cfe75c5b01199 was backported there
- 4.14.86 and later because 0cfe75c5b01199 was backported there
- 4.19
- 4.20-rcX


Martin Blumenstingl (1):
  f2fs: fix validation of the block count in sanity_check_raw_super

 fs/f2fs/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/1] f2fs: fix validation of the block count in sanity_check_raw_super
  2018-12-21 19:28 [PATCH 0/1] f2fs: fix sanity_check_raw_super on big endian machines Martin Blumenstingl
@ 2018-12-21 19:28 ` Martin Blumenstingl
  2018-12-22  2:24     ` Chao Yu
                     ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Martin Blumenstingl @ 2018-12-21 19:28 UTC (permalink / raw)
  To: linux-f2fs-devel, yuchao0, jaegeuk
  Cc: linux-kernel, stable, Martin Blumenstingl

Treat "block_count" from struct f2fs_super_block as 64-bit little endian
value in sanity_check_raw_super() because struct f2fs_super_block
declares "block_count" as "__le64".

This fixes a bug where the superblock validation fails on big endian
devices with the following error:
  F2FS-fs (sda1): Wrong segment_count / block_count (61439 > 0)
  F2FS-fs (sda1): Can't find valid F2FS filesystem in 1th superblock
  F2FS-fs (sda1): Wrong segment_count / block_count (61439 > 0)
  F2FS-fs (sda1): Can't find valid F2FS filesystem in 2th superblock
As result of this the partition cannot be mounted.

With this patch applied the superblock validation works fine and the
partition can be mounted again:
  F2FS-fs (sda1): Mounted with checkpoint version = 7c84

My little endian x86-64 hardware was able to mount the partition without
this fix.
To confirm that mounting f2fs filesystems works on big endian machines
again I tested this on a 32-bit MIPS big endian (lantiq) device.

Fixes: 0cfe75c5b01199 ("f2fs: enhance sanity_check_raw_super() to avoid potential overflows")
Cc: stable@vger.kernel.org
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 fs/f2fs/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index af58b2cc21b8..3a65d5af122a 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -2496,10 +2496,10 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi,
 		return 1;
 	}
 
-	if (segment_count > (le32_to_cpu(raw_super->block_count) >> 9)) {
+	if (segment_count > (le64_to_cpu(raw_super->block_count) >> 9)) {
 		f2fs_msg(sb, KERN_INFO,
 			"Wrong segment_count / block_count (%u > %u)",
-			segment_count, le32_to_cpu(raw_super->block_count));
+			segment_count, le64_to_cpu(raw_super->block_count));
 		return 1;
 	}
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] f2fs: fix validation of the block count in sanity_check_raw_super
  2018-12-21 19:28 ` [PATCH 1/1] f2fs: fix validation of the block count in sanity_check_raw_super Martin Blumenstingl
@ 2018-12-22  2:24     ` Chao Yu
  2018-12-22  7:00     ` kbuild test robot
  2018-12-22  9:30     ` kbuild test robot
  2 siblings, 0 replies; 12+ messages in thread
From: Chao Yu @ 2018-12-22  2:24 UTC (permalink / raw)
  To: Martin Blumenstingl, linux-f2fs-devel, jaegeuk; +Cc: linux-kernel, stable

On 2018/12/22 3:28, Martin Blumenstingl wrote:
> Treat "block_count" from struct f2fs_super_block as 64-bit little endian
> value in sanity_check_raw_super() because struct f2fs_super_block
> declares "block_count" as "__le64".
> 
> This fixes a bug where the superblock validation fails on big endian
> devices with the following error:
>   F2FS-fs (sda1): Wrong segment_count / block_count (61439 > 0)
>   F2FS-fs (sda1): Can't find valid F2FS filesystem in 1th superblock
>   F2FS-fs (sda1): Wrong segment_count / block_count (61439 > 0)
>   F2FS-fs (sda1): Can't find valid F2FS filesystem in 2th superblock
> As result of this the partition cannot be mounted.
> 
> With this patch applied the superblock validation works fine and the
> partition can be mounted again:
>   F2FS-fs (sda1): Mounted with checkpoint version = 7c84
> 
> My little endian x86-64 hardware was able to mount the partition without
> this fix.
> To confirm that mounting f2fs filesystems works on big endian machines
> again I tested this on a 32-bit MIPS big endian (lantiq) device.
> 
> Fixes: 0cfe75c5b01199 ("f2fs: enhance sanity_check_raw_super() to avoid potential overflows")
> Cc: stable@vger.kernel.org
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] f2fs: fix validation of the block count in sanity_check_raw_super
@ 2018-12-22  2:24     ` Chao Yu
  0 siblings, 0 replies; 12+ messages in thread
From: Chao Yu @ 2018-12-22  2:24 UTC (permalink / raw)
  To: Martin Blumenstingl, linux-f2fs-devel, jaegeuk; +Cc: linux-kernel, stable

On 2018/12/22 3:28, Martin Blumenstingl wrote:
> Treat "block_count" from struct f2fs_super_block as 64-bit little endian
> value in sanity_check_raw_super() because struct f2fs_super_block
> declares "block_count" as "__le64".
> 
> This fixes a bug where the superblock validation fails on big endian
> devices with the following error:
>   F2FS-fs (sda1): Wrong segment_count / block_count (61439 > 0)
>   F2FS-fs (sda1): Can't find valid F2FS filesystem in 1th superblock
>   F2FS-fs (sda1): Wrong segment_count / block_count (61439 > 0)
>   F2FS-fs (sda1): Can't find valid F2FS filesystem in 2th superblock
> As result of this the partition cannot be mounted.
> 
> With this patch applied the superblock validation works fine and the
> partition can be mounted again:
>   F2FS-fs (sda1): Mounted with checkpoint version = 7c84
> 
> My little endian x86-64 hardware was able to mount the partition without
> this fix.
> To confirm that mounting f2fs filesystems works on big endian machines
> again I tested this on a 32-bit MIPS big endian (lantiq) device.
> 
> Fixes: 0cfe75c5b01199 ("f2fs: enhance sanity_check_raw_super() to avoid potential overflows")
> Cc: stable@vger.kernel.org
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] f2fs: fix validation of the block count in sanity_check_raw_super
  2018-12-21 19:28 ` [PATCH 1/1] f2fs: fix validation of the block count in sanity_check_raw_super Martin Blumenstingl
@ 2018-12-22  7:00     ` kbuild test robot
  2018-12-22  7:00     ` kbuild test robot
  2018-12-22  9:30     ` kbuild test robot
  2 siblings, 0 replies; 12+ messages in thread
From: kbuild test robot @ 2018-12-22  7:00 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: kbuild-all, linux-f2fs-devel, yuchao0, jaegeuk, linux-kernel,
	stable, Martin Blumenstingl

[-- Attachment #1: Type: text/plain, Size: 14508 bytes --]

Hi Martin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on f2fs/dev-test]
[also build test WARNING on v4.20-rc7 next-20181221]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Martin-Blumenstingl/f2fs-fix-sanity_check_raw_super-on-big-endian-machines/20181222-142616
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
config: i386-randconfig-x006-201850 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   fs/f2fs/super.c: In function 'sanity_check_raw_super':
>> fs/f2fs/super.c:2498:46: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'long long unsigned int' [-Wformat=]
       "Wrong segment_count / block_count (%u > %u)",
                                                ~^
                                                %llu

vim +2498 fs/f2fs/super.c

9a59b62fd Chao Yu             2015-12-15  2382  
df728b0f6 Jaegeuk Kim         2016-03-23  2383  static int sanity_check_raw_super(struct f2fs_sb_info *sbi,
fd694733d Jaegeuk Kim         2016-03-20  2384  				struct buffer_head *bh)
aff063e26 Jaegeuk Kim         2012-11-02  2385  {
0cfe75c5b Jaegeuk Kim         2018-04-27  2386  	block_t segment_count, segs_per_sec, secs_per_zone;
0cfe75c5b Jaegeuk Kim         2018-04-27  2387  	block_t total_sections, blocks_per_seg;
fd694733d Jaegeuk Kim         2016-03-20  2388  	struct f2fs_super_block *raw_super = (struct f2fs_super_block *)
fd694733d Jaegeuk Kim         2016-03-20  2389  					(bh->b_data + F2FS_SUPER_OFFSET);
df728b0f6 Jaegeuk Kim         2016-03-23  2390  	struct super_block *sb = sbi->sb;
aff063e26 Jaegeuk Kim         2012-11-02  2391  	unsigned int blocksize;
d440c52d3 Junling Zheng       2018-09-28  2392  	size_t crc_offset = 0;
d440c52d3 Junling Zheng       2018-09-28  2393  	__u32 crc = 0;
d440c52d3 Junling Zheng       2018-09-28  2394  
d440c52d3 Junling Zheng       2018-09-28  2395  	/* Check checksum_offset and crc in superblock */
7beb01f74 Chao Yu             2018-10-24  2396  	if (__F2FS_HAS_FEATURE(raw_super, F2FS_FEATURE_SB_CHKSUM)) {
d440c52d3 Junling Zheng       2018-09-28  2397  		crc_offset = le32_to_cpu(raw_super->checksum_offset);
d440c52d3 Junling Zheng       2018-09-28  2398  		if (crc_offset !=
d440c52d3 Junling Zheng       2018-09-28  2399  			offsetof(struct f2fs_super_block, crc)) {
d440c52d3 Junling Zheng       2018-09-28  2400  			f2fs_msg(sb, KERN_INFO,
d440c52d3 Junling Zheng       2018-09-28  2401  				"Invalid SB checksum offset: %zu",
d440c52d3 Junling Zheng       2018-09-28  2402  				crc_offset);
d440c52d3 Junling Zheng       2018-09-28  2403  			return 1;
d440c52d3 Junling Zheng       2018-09-28  2404  		}
d440c52d3 Junling Zheng       2018-09-28  2405  		crc = le32_to_cpu(raw_super->crc);
d440c52d3 Junling Zheng       2018-09-28  2406  		if (!f2fs_crc_valid(sbi, crc, raw_super, crc_offset)) {
d440c52d3 Junling Zheng       2018-09-28  2407  			f2fs_msg(sb, KERN_INFO,
d440c52d3 Junling Zheng       2018-09-28  2408  				"Invalid SB checksum value: %u", crc);
d440c52d3 Junling Zheng       2018-09-28  2409  			return 1;
d440c52d3 Junling Zheng       2018-09-28  2410  		}
d440c52d3 Junling Zheng       2018-09-28  2411  	}
aff063e26 Jaegeuk Kim         2012-11-02  2412  
a07ef7843 Namjae Jeon         2012-12-30  2413  	if (F2FS_SUPER_MAGIC != le32_to_cpu(raw_super->magic)) {
a07ef7843 Namjae Jeon         2012-12-30  2414  		f2fs_msg(sb, KERN_INFO,
a07ef7843 Namjae Jeon         2012-12-30  2415  			"Magic Mismatch, valid(0x%x) - read(0x%x)",
a07ef7843 Namjae Jeon         2012-12-30  2416  			F2FS_SUPER_MAGIC, le32_to_cpu(raw_super->magic));
aff063e26 Jaegeuk Kim         2012-11-02  2417  		return 1;
a07ef7843 Namjae Jeon         2012-12-30  2418  	}
aff063e26 Jaegeuk Kim         2012-11-02  2419  
5c9b46929 majianpeng          2013-02-01  2420  	/* Currently, support only 4KB page cache size */
09cbfeaf1 Kirill A. Shutemov  2016-04-01  2421  	if (F2FS_BLKSIZE != PAGE_SIZE) {
5c9b46929 majianpeng          2013-02-01  2422  		f2fs_msg(sb, KERN_INFO,
14d7e9de0 majianpeng          2013-02-01  2423  			"Invalid page_cache_size (%lu), supports only 4KB\n",
09cbfeaf1 Kirill A. Shutemov  2016-04-01  2424  			PAGE_SIZE);
5c9b46929 majianpeng          2013-02-01  2425  		return 1;
5c9b46929 majianpeng          2013-02-01  2426  	}
5c9b46929 majianpeng          2013-02-01  2427  
aff063e26 Jaegeuk Kim         2012-11-02  2428  	/* Currently, support only 4KB block size */
aff063e26 Jaegeuk Kim         2012-11-02  2429  	blocksize = 1 << le32_to_cpu(raw_super->log_blocksize);
5c9b46929 majianpeng          2013-02-01  2430  	if (blocksize != F2FS_BLKSIZE) {
a07ef7843 Namjae Jeon         2012-12-30  2431  		f2fs_msg(sb, KERN_INFO,
a07ef7843 Namjae Jeon         2012-12-30  2432  			"Invalid blocksize (%u), supports only 4KB\n",
a07ef7843 Namjae Jeon         2012-12-30  2433  			blocksize);
aff063e26 Jaegeuk Kim         2012-11-02  2434  		return 1;
a07ef7843 Namjae Jeon         2012-12-30  2435  	}
5c9b46929 majianpeng          2013-02-01  2436  
9a59b62fd Chao Yu             2015-12-15  2437  	/* check log blocks per segment */
9a59b62fd Chao Yu             2015-12-15  2438  	if (le32_to_cpu(raw_super->log_blocks_per_seg) != 9) {
9a59b62fd Chao Yu             2015-12-15  2439  		f2fs_msg(sb, KERN_INFO,
9a59b62fd Chao Yu             2015-12-15  2440  			"Invalid log blocks per segment (%u)\n",
9a59b62fd Chao Yu             2015-12-15  2441  			le32_to_cpu(raw_super->log_blocks_per_seg));
9a59b62fd Chao Yu             2015-12-15  2442  		return 1;
9a59b62fd Chao Yu             2015-12-15  2443  	}
9a59b62fd Chao Yu             2015-12-15  2444  
55cf9cb63 Chao Yu             2014-09-15  2445  	/* Currently, support 512/1024/2048/4096 bytes sector size */
55cf9cb63 Chao Yu             2014-09-15  2446  	if (le32_to_cpu(raw_super->log_sectorsize) >
55cf9cb63 Chao Yu             2014-09-15  2447  				F2FS_MAX_LOG_SECTOR_SIZE ||
55cf9cb63 Chao Yu             2014-09-15  2448  		le32_to_cpu(raw_super->log_sectorsize) <
55cf9cb63 Chao Yu             2014-09-15  2449  				F2FS_MIN_LOG_SECTOR_SIZE) {
55cf9cb63 Chao Yu             2014-09-15  2450  		f2fs_msg(sb, KERN_INFO, "Invalid log sectorsize (%u)",
55cf9cb63 Chao Yu             2014-09-15  2451  			le32_to_cpu(raw_super->log_sectorsize));
aff063e26 Jaegeuk Kim         2012-11-02  2452  		return 1;
a07ef7843 Namjae Jeon         2012-12-30  2453  	}
55cf9cb63 Chao Yu             2014-09-15  2454  	if (le32_to_cpu(raw_super->log_sectors_per_block) +
55cf9cb63 Chao Yu             2014-09-15  2455  		le32_to_cpu(raw_super->log_sectorsize) !=
55cf9cb63 Chao Yu             2014-09-15  2456  			F2FS_MAX_LOG_SECTOR_SIZE) {
55cf9cb63 Chao Yu             2014-09-15  2457  		f2fs_msg(sb, KERN_INFO,
55cf9cb63 Chao Yu             2014-09-15  2458  			"Invalid log sectors per block(%u) log sectorsize(%u)",
55cf9cb63 Chao Yu             2014-09-15  2459  			le32_to_cpu(raw_super->log_sectors_per_block),
55cf9cb63 Chao Yu             2014-09-15  2460  			le32_to_cpu(raw_super->log_sectorsize));
aff063e26 Jaegeuk Kim         2012-11-02  2461  		return 1;
a07ef7843 Namjae Jeon         2012-12-30  2462  	}
9a59b62fd Chao Yu             2015-12-15  2463  
0cfe75c5b Jaegeuk Kim         2018-04-27  2464  	segment_count = le32_to_cpu(raw_super->segment_count);
0cfe75c5b Jaegeuk Kim         2018-04-27  2465  	segs_per_sec = le32_to_cpu(raw_super->segs_per_sec);
0cfe75c5b Jaegeuk Kim         2018-04-27  2466  	secs_per_zone = le32_to_cpu(raw_super->secs_per_zone);
0cfe75c5b Jaegeuk Kim         2018-04-27  2467  	total_sections = le32_to_cpu(raw_super->section_count);
0cfe75c5b Jaegeuk Kim         2018-04-27  2468  
0cfe75c5b Jaegeuk Kim         2018-04-27  2469  	/* blocks_per_seg should be 512, given the above check */
0cfe75c5b Jaegeuk Kim         2018-04-27  2470  	blocks_per_seg = 1 << le32_to_cpu(raw_super->log_blocks_per_seg);
0cfe75c5b Jaegeuk Kim         2018-04-27  2471  
0cfe75c5b Jaegeuk Kim         2018-04-27  2472  	if (segment_count > F2FS_MAX_SEGMENT ||
0cfe75c5b Jaegeuk Kim         2018-04-27  2473  				segment_count < F2FS_MIN_SEGMENTS) {
0cfe75c5b Jaegeuk Kim         2018-04-27  2474  		f2fs_msg(sb, KERN_INFO,
0cfe75c5b Jaegeuk Kim         2018-04-27  2475  			"Invalid segment count (%u)",
0cfe75c5b Jaegeuk Kim         2018-04-27  2476  			segment_count);
0cfe75c5b Jaegeuk Kim         2018-04-27  2477  		return 1;
0cfe75c5b Jaegeuk Kim         2018-04-27  2478  	}
0cfe75c5b Jaegeuk Kim         2018-04-27  2479  
0cfe75c5b Jaegeuk Kim         2018-04-27  2480  	if (total_sections > segment_count ||
0cfe75c5b Jaegeuk Kim         2018-04-27  2481  			total_sections < F2FS_MIN_SEGMENTS ||
0cfe75c5b Jaegeuk Kim         2018-04-27  2482  			segs_per_sec > segment_count || !segs_per_sec) {
0cfe75c5b Jaegeuk Kim         2018-04-27  2483  		f2fs_msg(sb, KERN_INFO,
0cfe75c5b Jaegeuk Kim         2018-04-27  2484  			"Invalid segment/section count (%u, %u x %u)",
0cfe75c5b Jaegeuk Kim         2018-04-27  2485  			segment_count, total_sections, segs_per_sec);
0cfe75c5b Jaegeuk Kim         2018-04-27  2486  		return 1;
0cfe75c5b Jaegeuk Kim         2018-04-27  2487  	}
0cfe75c5b Jaegeuk Kim         2018-04-27  2488  
0cfe75c5b Jaegeuk Kim         2018-04-27  2489  	if ((segment_count / segs_per_sec) < total_sections) {
0cfe75c5b Jaegeuk Kim         2018-04-27  2490  		f2fs_msg(sb, KERN_INFO,
0cfe75c5b Jaegeuk Kim         2018-04-27  2491  			"Small segment_count (%u < %u * %u)",
0cfe75c5b Jaegeuk Kim         2018-04-27  2492  			segment_count, segs_per_sec, total_sections);
0cfe75c5b Jaegeuk Kim         2018-04-27  2493  		return 1;
0cfe75c5b Jaegeuk Kim         2018-04-27  2494  	}
0cfe75c5b Jaegeuk Kim         2018-04-27  2495  
096ee6221 Martin Blumenstingl 2018-12-21  2496  	if (segment_count > (le64_to_cpu(raw_super->block_count) >> 9)) {
0cfe75c5b Jaegeuk Kim         2018-04-27  2497  		f2fs_msg(sb, KERN_INFO,
0cfe75c5b Jaegeuk Kim         2018-04-27 @2498  			"Wrong segment_count / block_count (%u > %u)",
096ee6221 Martin Blumenstingl 2018-12-21  2499  			segment_count, le64_to_cpu(raw_super->block_count));
0cfe75c5b Jaegeuk Kim         2018-04-27  2500  		return 1;
0cfe75c5b Jaegeuk Kim         2018-04-27  2501  	}
0cfe75c5b Jaegeuk Kim         2018-04-27  2502  
42bf546c1 Chao Yu             2018-06-23  2503  	if (secs_per_zone > total_sections || !secs_per_zone) {
0cfe75c5b Jaegeuk Kim         2018-04-27  2504  		f2fs_msg(sb, KERN_INFO,
42bf546c1 Chao Yu             2018-06-23  2505  			"Wrong secs_per_zone / total_sections (%u, %u)",
0cfe75c5b Jaegeuk Kim         2018-04-27  2506  			secs_per_zone, total_sections);
0cfe75c5b Jaegeuk Kim         2018-04-27  2507  		return 1;
0cfe75c5b Jaegeuk Kim         2018-04-27  2508  	}
0cfe75c5b Jaegeuk Kim         2018-04-27  2509  	if (le32_to_cpu(raw_super->extension_count) > F2FS_MAX_EXTENSION ||
0cfe75c5b Jaegeuk Kim         2018-04-27  2510  			raw_super->hot_ext_count > F2FS_MAX_EXTENSION ||
0cfe75c5b Jaegeuk Kim         2018-04-27  2511  			(le32_to_cpu(raw_super->extension_count) +
0cfe75c5b Jaegeuk Kim         2018-04-27  2512  			raw_super->hot_ext_count) > F2FS_MAX_EXTENSION) {
0cfe75c5b Jaegeuk Kim         2018-04-27  2513  		f2fs_msg(sb, KERN_INFO,
0cfe75c5b Jaegeuk Kim         2018-04-27  2514  			"Corrupted extension count (%u + %u > %u)",
0cfe75c5b Jaegeuk Kim         2018-04-27  2515  			le32_to_cpu(raw_super->extension_count),
0cfe75c5b Jaegeuk Kim         2018-04-27  2516  			raw_super->hot_ext_count,
0cfe75c5b Jaegeuk Kim         2018-04-27  2517  			F2FS_MAX_EXTENSION);
0cfe75c5b Jaegeuk Kim         2018-04-27  2518  		return 1;
0cfe75c5b Jaegeuk Kim         2018-04-27  2519  	}
0cfe75c5b Jaegeuk Kim         2018-04-27  2520  
0cfe75c5b Jaegeuk Kim         2018-04-27  2521  	if (le32_to_cpu(raw_super->cp_payload) >
0cfe75c5b Jaegeuk Kim         2018-04-27  2522  				(blocks_per_seg - F2FS_CP_PACKS)) {
0cfe75c5b Jaegeuk Kim         2018-04-27  2523  		f2fs_msg(sb, KERN_INFO,
0cfe75c5b Jaegeuk Kim         2018-04-27  2524  			"Insane cp_payload (%u > %u)",
0cfe75c5b Jaegeuk Kim         2018-04-27  2525  			le32_to_cpu(raw_super->cp_payload),
0cfe75c5b Jaegeuk Kim         2018-04-27  2526  			blocks_per_seg - F2FS_CP_PACKS);
0cfe75c5b Jaegeuk Kim         2018-04-27  2527  		return 1;
0cfe75c5b Jaegeuk Kim         2018-04-27  2528  	}
0cfe75c5b Jaegeuk Kim         2018-04-27  2529  
9a59b62fd Chao Yu             2015-12-15  2530  	/* check reserved ino info */
9a59b62fd Chao Yu             2015-12-15  2531  	if (le32_to_cpu(raw_super->node_ino) != 1 ||
9a59b62fd Chao Yu             2015-12-15  2532  		le32_to_cpu(raw_super->meta_ino) != 2 ||
9a59b62fd Chao Yu             2015-12-15  2533  		le32_to_cpu(raw_super->root_ino) != 3) {
9a59b62fd Chao Yu             2015-12-15  2534  		f2fs_msg(sb, KERN_INFO,
9a59b62fd Chao Yu             2015-12-15  2535  			"Invalid Fs Meta Ino: node(%u) meta(%u) root(%u)",
9a59b62fd Chao Yu             2015-12-15  2536  			le32_to_cpu(raw_super->node_ino),
9a59b62fd Chao Yu             2015-12-15  2537  			le32_to_cpu(raw_super->meta_ino),
9a59b62fd Chao Yu             2015-12-15  2538  			le32_to_cpu(raw_super->root_ino));
9a59b62fd Chao Yu             2015-12-15  2539  		return 1;
9a59b62fd Chao Yu             2015-12-15  2540  	}
9a59b62fd Chao Yu             2015-12-15  2541  
9a59b62fd Chao Yu             2015-12-15  2542  	/* check CP/SIT/NAT/SSA/MAIN_AREA area boundary */
df728b0f6 Jaegeuk Kim         2016-03-23  2543  	if (sanity_check_area_boundary(sbi, bh))
9a59b62fd Chao Yu             2015-12-15  2544  		return 1;
9a59b62fd Chao Yu             2015-12-15  2545  
aff063e26 Jaegeuk Kim         2012-11-02  2546  	return 0;
aff063e26 Jaegeuk Kim         2012-11-02  2547  }
aff063e26 Jaegeuk Kim         2012-11-02  2548  

:::::: The code at line 2498 was first introduced by commit
:::::: 0cfe75c5b011994651a4ca6d74f20aa997bfc69a f2fs: enhance sanity_check_raw_super() to avoid potential overflows

:::::: TO: Jaegeuk Kim <jaegeuk@kernel.org>
:::::: CC: Jaegeuk Kim <jaegeuk@kernel.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28544 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] f2fs: fix validation of the block count in sanity_check_raw_super
@ 2018-12-22  7:00     ` kbuild test robot
  0 siblings, 0 replies; 12+ messages in thread
From: kbuild test robot @ 2018-12-22  7:00 UTC (permalink / raw)
  Cc: kbuild-all, linux-f2fs-devel, yuchao0, jaegeuk, linux-kernel,
	stable, Martin Blumenstingl

[-- Attachment #1: Type: text/plain, Size: 14508 bytes --]

Hi Martin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on f2fs/dev-test]
[also build test WARNING on v4.20-rc7 next-20181221]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Martin-Blumenstingl/f2fs-fix-sanity_check_raw_super-on-big-endian-machines/20181222-142616
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
config: i386-randconfig-x006-201850 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   fs/f2fs/super.c: In function 'sanity_check_raw_super':
>> fs/f2fs/super.c:2498:46: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'long long unsigned int' [-Wformat=]
       "Wrong segment_count / block_count (%u > %u)",
                                                ~^
                                                %llu

vim +2498 fs/f2fs/super.c

9a59b62fd Chao Yu             2015-12-15  2382  
df728b0f6 Jaegeuk Kim         2016-03-23  2383  static int sanity_check_raw_super(struct f2fs_sb_info *sbi,
fd694733d Jaegeuk Kim         2016-03-20  2384  				struct buffer_head *bh)
aff063e26 Jaegeuk Kim         2012-11-02  2385  {
0cfe75c5b Jaegeuk Kim         2018-04-27  2386  	block_t segment_count, segs_per_sec, secs_per_zone;
0cfe75c5b Jaegeuk Kim         2018-04-27  2387  	block_t total_sections, blocks_per_seg;
fd694733d Jaegeuk Kim         2016-03-20  2388  	struct f2fs_super_block *raw_super = (struct f2fs_super_block *)
fd694733d Jaegeuk Kim         2016-03-20  2389  					(bh->b_data + F2FS_SUPER_OFFSET);
df728b0f6 Jaegeuk Kim         2016-03-23  2390  	struct super_block *sb = sbi->sb;
aff063e26 Jaegeuk Kim         2012-11-02  2391  	unsigned int blocksize;
d440c52d3 Junling Zheng       2018-09-28  2392  	size_t crc_offset = 0;
d440c52d3 Junling Zheng       2018-09-28  2393  	__u32 crc = 0;
d440c52d3 Junling Zheng       2018-09-28  2394  
d440c52d3 Junling Zheng       2018-09-28  2395  	/* Check checksum_offset and crc in superblock */
7beb01f74 Chao Yu             2018-10-24  2396  	if (__F2FS_HAS_FEATURE(raw_super, F2FS_FEATURE_SB_CHKSUM)) {
d440c52d3 Junling Zheng       2018-09-28  2397  		crc_offset = le32_to_cpu(raw_super->checksum_offset);
d440c52d3 Junling Zheng       2018-09-28  2398  		if (crc_offset !=
d440c52d3 Junling Zheng       2018-09-28  2399  			offsetof(struct f2fs_super_block, crc)) {
d440c52d3 Junling Zheng       2018-09-28  2400  			f2fs_msg(sb, KERN_INFO,
d440c52d3 Junling Zheng       2018-09-28  2401  				"Invalid SB checksum offset: %zu",
d440c52d3 Junling Zheng       2018-09-28  2402  				crc_offset);
d440c52d3 Junling Zheng       2018-09-28  2403  			return 1;
d440c52d3 Junling Zheng       2018-09-28  2404  		}
d440c52d3 Junling Zheng       2018-09-28  2405  		crc = le32_to_cpu(raw_super->crc);
d440c52d3 Junling Zheng       2018-09-28  2406  		if (!f2fs_crc_valid(sbi, crc, raw_super, crc_offset)) {
d440c52d3 Junling Zheng       2018-09-28  2407  			f2fs_msg(sb, KERN_INFO,
d440c52d3 Junling Zheng       2018-09-28  2408  				"Invalid SB checksum value: %u", crc);
d440c52d3 Junling Zheng       2018-09-28  2409  			return 1;
d440c52d3 Junling Zheng       2018-09-28  2410  		}
d440c52d3 Junling Zheng       2018-09-28  2411  	}
aff063e26 Jaegeuk Kim         2012-11-02  2412  
a07ef7843 Namjae Jeon         2012-12-30  2413  	if (F2FS_SUPER_MAGIC != le32_to_cpu(raw_super->magic)) {
a07ef7843 Namjae Jeon         2012-12-30  2414  		f2fs_msg(sb, KERN_INFO,
a07ef7843 Namjae Jeon         2012-12-30  2415  			"Magic Mismatch, valid(0x%x) - read(0x%x)",
a07ef7843 Namjae Jeon         2012-12-30  2416  			F2FS_SUPER_MAGIC, le32_to_cpu(raw_super->magic));
aff063e26 Jaegeuk Kim         2012-11-02  2417  		return 1;
a07ef7843 Namjae Jeon         2012-12-30  2418  	}
aff063e26 Jaegeuk Kim         2012-11-02  2419  
5c9b46929 majianpeng          2013-02-01  2420  	/* Currently, support only 4KB page cache size */
09cbfeaf1 Kirill A. Shutemov  2016-04-01  2421  	if (F2FS_BLKSIZE != PAGE_SIZE) {
5c9b46929 majianpeng          2013-02-01  2422  		f2fs_msg(sb, KERN_INFO,
14d7e9de0 majianpeng          2013-02-01  2423  			"Invalid page_cache_size (%lu), supports only 4KB\n",
09cbfeaf1 Kirill A. Shutemov  2016-04-01  2424  			PAGE_SIZE);
5c9b46929 majianpeng          2013-02-01  2425  		return 1;
5c9b46929 majianpeng          2013-02-01  2426  	}
5c9b46929 majianpeng          2013-02-01  2427  
aff063e26 Jaegeuk Kim         2012-11-02  2428  	/* Currently, support only 4KB block size */
aff063e26 Jaegeuk Kim         2012-11-02  2429  	blocksize = 1 << le32_to_cpu(raw_super->log_blocksize);
5c9b46929 majianpeng          2013-02-01  2430  	if (blocksize != F2FS_BLKSIZE) {
a07ef7843 Namjae Jeon         2012-12-30  2431  		f2fs_msg(sb, KERN_INFO,
a07ef7843 Namjae Jeon         2012-12-30  2432  			"Invalid blocksize (%u), supports only 4KB\n",
a07ef7843 Namjae Jeon         2012-12-30  2433  			blocksize);
aff063e26 Jaegeuk Kim         2012-11-02  2434  		return 1;
a07ef7843 Namjae Jeon         2012-12-30  2435  	}
5c9b46929 majianpeng          2013-02-01  2436  
9a59b62fd Chao Yu             2015-12-15  2437  	/* check log blocks per segment */
9a59b62fd Chao Yu             2015-12-15  2438  	if (le32_to_cpu(raw_super->log_blocks_per_seg) != 9) {
9a59b62fd Chao Yu             2015-12-15  2439  		f2fs_msg(sb, KERN_INFO,
9a59b62fd Chao Yu             2015-12-15  2440  			"Invalid log blocks per segment (%u)\n",
9a59b62fd Chao Yu             2015-12-15  2441  			le32_to_cpu(raw_super->log_blocks_per_seg));
9a59b62fd Chao Yu             2015-12-15  2442  		return 1;
9a59b62fd Chao Yu             2015-12-15  2443  	}
9a59b62fd Chao Yu             2015-12-15  2444  
55cf9cb63 Chao Yu             2014-09-15  2445  	/* Currently, support 512/1024/2048/4096 bytes sector size */
55cf9cb63 Chao Yu             2014-09-15  2446  	if (le32_to_cpu(raw_super->log_sectorsize) >
55cf9cb63 Chao Yu             2014-09-15  2447  				F2FS_MAX_LOG_SECTOR_SIZE ||
55cf9cb63 Chao Yu             2014-09-15  2448  		le32_to_cpu(raw_super->log_sectorsize) <
55cf9cb63 Chao Yu             2014-09-15  2449  				F2FS_MIN_LOG_SECTOR_SIZE) {
55cf9cb63 Chao Yu             2014-09-15  2450  		f2fs_msg(sb, KERN_INFO, "Invalid log sectorsize (%u)",
55cf9cb63 Chao Yu             2014-09-15  2451  			le32_to_cpu(raw_super->log_sectorsize));
aff063e26 Jaegeuk Kim         2012-11-02  2452  		return 1;
a07ef7843 Namjae Jeon         2012-12-30  2453  	}
55cf9cb63 Chao Yu             2014-09-15  2454  	if (le32_to_cpu(raw_super->log_sectors_per_block) +
55cf9cb63 Chao Yu             2014-09-15  2455  		le32_to_cpu(raw_super->log_sectorsize) !=
55cf9cb63 Chao Yu             2014-09-15  2456  			F2FS_MAX_LOG_SECTOR_SIZE) {
55cf9cb63 Chao Yu             2014-09-15  2457  		f2fs_msg(sb, KERN_INFO,
55cf9cb63 Chao Yu             2014-09-15  2458  			"Invalid log sectors per block(%u) log sectorsize(%u)",
55cf9cb63 Chao Yu             2014-09-15  2459  			le32_to_cpu(raw_super->log_sectors_per_block),
55cf9cb63 Chao Yu             2014-09-15  2460  			le32_to_cpu(raw_super->log_sectorsize));
aff063e26 Jaegeuk Kim         2012-11-02  2461  		return 1;
a07ef7843 Namjae Jeon         2012-12-30  2462  	}
9a59b62fd Chao Yu             2015-12-15  2463  
0cfe75c5b Jaegeuk Kim         2018-04-27  2464  	segment_count = le32_to_cpu(raw_super->segment_count);
0cfe75c5b Jaegeuk Kim         2018-04-27  2465  	segs_per_sec = le32_to_cpu(raw_super->segs_per_sec);
0cfe75c5b Jaegeuk Kim         2018-04-27  2466  	secs_per_zone = le32_to_cpu(raw_super->secs_per_zone);
0cfe75c5b Jaegeuk Kim         2018-04-27  2467  	total_sections = le32_to_cpu(raw_super->section_count);
0cfe75c5b Jaegeuk Kim         2018-04-27  2468  
0cfe75c5b Jaegeuk Kim         2018-04-27  2469  	/* blocks_per_seg should be 512, given the above check */
0cfe75c5b Jaegeuk Kim         2018-04-27  2470  	blocks_per_seg = 1 << le32_to_cpu(raw_super->log_blocks_per_seg);
0cfe75c5b Jaegeuk Kim         2018-04-27  2471  
0cfe75c5b Jaegeuk Kim         2018-04-27  2472  	if (segment_count > F2FS_MAX_SEGMENT ||
0cfe75c5b Jaegeuk Kim         2018-04-27  2473  				segment_count < F2FS_MIN_SEGMENTS) {
0cfe75c5b Jaegeuk Kim         2018-04-27  2474  		f2fs_msg(sb, KERN_INFO,
0cfe75c5b Jaegeuk Kim         2018-04-27  2475  			"Invalid segment count (%u)",
0cfe75c5b Jaegeuk Kim         2018-04-27  2476  			segment_count);
0cfe75c5b Jaegeuk Kim         2018-04-27  2477  		return 1;
0cfe75c5b Jaegeuk Kim         2018-04-27  2478  	}
0cfe75c5b Jaegeuk Kim         2018-04-27  2479  
0cfe75c5b Jaegeuk Kim         2018-04-27  2480  	if (total_sections > segment_count ||
0cfe75c5b Jaegeuk Kim         2018-04-27  2481  			total_sections < F2FS_MIN_SEGMENTS ||
0cfe75c5b Jaegeuk Kim         2018-04-27  2482  			segs_per_sec > segment_count || !segs_per_sec) {
0cfe75c5b Jaegeuk Kim         2018-04-27  2483  		f2fs_msg(sb, KERN_INFO,
0cfe75c5b Jaegeuk Kim         2018-04-27  2484  			"Invalid segment/section count (%u, %u x %u)",
0cfe75c5b Jaegeuk Kim         2018-04-27  2485  			segment_count, total_sections, segs_per_sec);
0cfe75c5b Jaegeuk Kim         2018-04-27  2486  		return 1;
0cfe75c5b Jaegeuk Kim         2018-04-27  2487  	}
0cfe75c5b Jaegeuk Kim         2018-04-27  2488  
0cfe75c5b Jaegeuk Kim         2018-04-27  2489  	if ((segment_count / segs_per_sec) < total_sections) {
0cfe75c5b Jaegeuk Kim         2018-04-27  2490  		f2fs_msg(sb, KERN_INFO,
0cfe75c5b Jaegeuk Kim         2018-04-27  2491  			"Small segment_count (%u < %u * %u)",
0cfe75c5b Jaegeuk Kim         2018-04-27  2492  			segment_count, segs_per_sec, total_sections);
0cfe75c5b Jaegeuk Kim         2018-04-27  2493  		return 1;
0cfe75c5b Jaegeuk Kim         2018-04-27  2494  	}
0cfe75c5b Jaegeuk Kim         2018-04-27  2495  
096ee6221 Martin Blumenstingl 2018-12-21  2496  	if (segment_count > (le64_to_cpu(raw_super->block_count) >> 9)) {
0cfe75c5b Jaegeuk Kim         2018-04-27  2497  		f2fs_msg(sb, KERN_INFO,
0cfe75c5b Jaegeuk Kim         2018-04-27 @2498  			"Wrong segment_count / block_count (%u > %u)",
096ee6221 Martin Blumenstingl 2018-12-21  2499  			segment_count, le64_to_cpu(raw_super->block_count));
0cfe75c5b Jaegeuk Kim         2018-04-27  2500  		return 1;
0cfe75c5b Jaegeuk Kim         2018-04-27  2501  	}
0cfe75c5b Jaegeuk Kim         2018-04-27  2502  
42bf546c1 Chao Yu             2018-06-23  2503  	if (secs_per_zone > total_sections || !secs_per_zone) {
0cfe75c5b Jaegeuk Kim         2018-04-27  2504  		f2fs_msg(sb, KERN_INFO,
42bf546c1 Chao Yu             2018-06-23  2505  			"Wrong secs_per_zone / total_sections (%u, %u)",
0cfe75c5b Jaegeuk Kim         2018-04-27  2506  			secs_per_zone, total_sections);
0cfe75c5b Jaegeuk Kim         2018-04-27  2507  		return 1;
0cfe75c5b Jaegeuk Kim         2018-04-27  2508  	}
0cfe75c5b Jaegeuk Kim         2018-04-27  2509  	if (le32_to_cpu(raw_super->extension_count) > F2FS_MAX_EXTENSION ||
0cfe75c5b Jaegeuk Kim         2018-04-27  2510  			raw_super->hot_ext_count > F2FS_MAX_EXTENSION ||
0cfe75c5b Jaegeuk Kim         2018-04-27  2511  			(le32_to_cpu(raw_super->extension_count) +
0cfe75c5b Jaegeuk Kim         2018-04-27  2512  			raw_super->hot_ext_count) > F2FS_MAX_EXTENSION) {
0cfe75c5b Jaegeuk Kim         2018-04-27  2513  		f2fs_msg(sb, KERN_INFO,
0cfe75c5b Jaegeuk Kim         2018-04-27  2514  			"Corrupted extension count (%u + %u > %u)",
0cfe75c5b Jaegeuk Kim         2018-04-27  2515  			le32_to_cpu(raw_super->extension_count),
0cfe75c5b Jaegeuk Kim         2018-04-27  2516  			raw_super->hot_ext_count,
0cfe75c5b Jaegeuk Kim         2018-04-27  2517  			F2FS_MAX_EXTENSION);
0cfe75c5b Jaegeuk Kim         2018-04-27  2518  		return 1;
0cfe75c5b Jaegeuk Kim         2018-04-27  2519  	}
0cfe75c5b Jaegeuk Kim         2018-04-27  2520  
0cfe75c5b Jaegeuk Kim         2018-04-27  2521  	if (le32_to_cpu(raw_super->cp_payload) >
0cfe75c5b Jaegeuk Kim         2018-04-27  2522  				(blocks_per_seg - F2FS_CP_PACKS)) {
0cfe75c5b Jaegeuk Kim         2018-04-27  2523  		f2fs_msg(sb, KERN_INFO,
0cfe75c5b Jaegeuk Kim         2018-04-27  2524  			"Insane cp_payload (%u > %u)",
0cfe75c5b Jaegeuk Kim         2018-04-27  2525  			le32_to_cpu(raw_super->cp_payload),
0cfe75c5b Jaegeuk Kim         2018-04-27  2526  			blocks_per_seg - F2FS_CP_PACKS);
0cfe75c5b Jaegeuk Kim         2018-04-27  2527  		return 1;
0cfe75c5b Jaegeuk Kim         2018-04-27  2528  	}
0cfe75c5b Jaegeuk Kim         2018-04-27  2529  
9a59b62fd Chao Yu             2015-12-15  2530  	/* check reserved ino info */
9a59b62fd Chao Yu             2015-12-15  2531  	if (le32_to_cpu(raw_super->node_ino) != 1 ||
9a59b62fd Chao Yu             2015-12-15  2532  		le32_to_cpu(raw_super->meta_ino) != 2 ||
9a59b62fd Chao Yu             2015-12-15  2533  		le32_to_cpu(raw_super->root_ino) != 3) {
9a59b62fd Chao Yu             2015-12-15  2534  		f2fs_msg(sb, KERN_INFO,
9a59b62fd Chao Yu             2015-12-15  2535  			"Invalid Fs Meta Ino: node(%u) meta(%u) root(%u)",
9a59b62fd Chao Yu             2015-12-15  2536  			le32_to_cpu(raw_super->node_ino),
9a59b62fd Chao Yu             2015-12-15  2537  			le32_to_cpu(raw_super->meta_ino),
9a59b62fd Chao Yu             2015-12-15  2538  			le32_to_cpu(raw_super->root_ino));
9a59b62fd Chao Yu             2015-12-15  2539  		return 1;
9a59b62fd Chao Yu             2015-12-15  2540  	}
9a59b62fd Chao Yu             2015-12-15  2541  
9a59b62fd Chao Yu             2015-12-15  2542  	/* check CP/SIT/NAT/SSA/MAIN_AREA area boundary */
df728b0f6 Jaegeuk Kim         2016-03-23  2543  	if (sanity_check_area_boundary(sbi, bh))
9a59b62fd Chao Yu             2015-12-15  2544  		return 1;
9a59b62fd Chao Yu             2015-12-15  2545  
aff063e26 Jaegeuk Kim         2012-11-02  2546  	return 0;
aff063e26 Jaegeuk Kim         2012-11-02  2547  }
aff063e26 Jaegeuk Kim         2012-11-02  2548  

:::::: The code at line 2498 was first introduced by commit
:::::: 0cfe75c5b011994651a4ca6d74f20aa997bfc69a f2fs: enhance sanity_check_raw_super() to avoid potential overflows

:::::: TO: Jaegeuk Kim <jaegeuk@kernel.org>
:::::: CC: Jaegeuk Kim <jaegeuk@kernel.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28544 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] f2fs: fix validation of the block count in sanity_check_raw_super
  2018-12-21 19:28 ` [PATCH 1/1] f2fs: fix validation of the block count in sanity_check_raw_super Martin Blumenstingl
@ 2018-12-22  9:30     ` kbuild test robot
  2018-12-22  7:00     ` kbuild test robot
  2018-12-22  9:30     ` kbuild test robot
  2 siblings, 0 replies; 12+ messages in thread
From: kbuild test robot @ 2018-12-22  9:30 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: kbuild-all, linux-f2fs-devel, yuchao0, jaegeuk, linux-kernel,
	stable, Martin Blumenstingl

[-- Attachment #1: Type: text/plain, Size: 7291 bytes --]

Hi Martin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on f2fs/dev-test]
[also build test WARNING on v4.20-rc7 next-20181221]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Martin-Blumenstingl/f2fs-fix-sanity_check_raw_super-on-big-endian-machines/20181222-142616
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
config: i386-randconfig-a3-12211242 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   fs/f2fs/super.c: In function 'sanity_check_raw_super':
>> fs/f2fs/super.c:2499:4: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type '__le64' [-Wformat=]
       segment_count, le64_to_cpu(raw_super->block_count));
       ^

vim +2499 fs/f2fs/super.c

  2382	
  2383	static int sanity_check_raw_super(struct f2fs_sb_info *sbi,
  2384					struct buffer_head *bh)
  2385	{
  2386		block_t segment_count, segs_per_sec, secs_per_zone;
  2387		block_t total_sections, blocks_per_seg;
  2388		struct f2fs_super_block *raw_super = (struct f2fs_super_block *)
  2389						(bh->b_data + F2FS_SUPER_OFFSET);
  2390		struct super_block *sb = sbi->sb;
  2391		unsigned int blocksize;
  2392		size_t crc_offset = 0;
  2393		__u32 crc = 0;
  2394	
  2395		/* Check checksum_offset and crc in superblock */
  2396		if (__F2FS_HAS_FEATURE(raw_super, F2FS_FEATURE_SB_CHKSUM)) {
  2397			crc_offset = le32_to_cpu(raw_super->checksum_offset);
  2398			if (crc_offset !=
  2399				offsetof(struct f2fs_super_block, crc)) {
  2400				f2fs_msg(sb, KERN_INFO,
  2401					"Invalid SB checksum offset: %zu",
  2402					crc_offset);
  2403				return 1;
  2404			}
  2405			crc = le32_to_cpu(raw_super->crc);
  2406			if (!f2fs_crc_valid(sbi, crc, raw_super, crc_offset)) {
  2407				f2fs_msg(sb, KERN_INFO,
  2408					"Invalid SB checksum value: %u", crc);
  2409				return 1;
  2410			}
  2411		}
  2412	
  2413		if (F2FS_SUPER_MAGIC != le32_to_cpu(raw_super->magic)) {
  2414			f2fs_msg(sb, KERN_INFO,
  2415				"Magic Mismatch, valid(0x%x) - read(0x%x)",
  2416				F2FS_SUPER_MAGIC, le32_to_cpu(raw_super->magic));
  2417			return 1;
  2418		}
  2419	
  2420		/* Currently, support only 4KB page cache size */
  2421		if (F2FS_BLKSIZE != PAGE_SIZE) {
  2422			f2fs_msg(sb, KERN_INFO,
  2423				"Invalid page_cache_size (%lu), supports only 4KB\n",
  2424				PAGE_SIZE);
  2425			return 1;
  2426		}
  2427	
  2428		/* Currently, support only 4KB block size */
  2429		blocksize = 1 << le32_to_cpu(raw_super->log_blocksize);
  2430		if (blocksize != F2FS_BLKSIZE) {
  2431			f2fs_msg(sb, KERN_INFO,
  2432				"Invalid blocksize (%u), supports only 4KB\n",
  2433				blocksize);
  2434			return 1;
  2435		}
  2436	
  2437		/* check log blocks per segment */
  2438		if (le32_to_cpu(raw_super->log_blocks_per_seg) != 9) {
  2439			f2fs_msg(sb, KERN_INFO,
  2440				"Invalid log blocks per segment (%u)\n",
  2441				le32_to_cpu(raw_super->log_blocks_per_seg));
  2442			return 1;
  2443		}
  2444	
  2445		/* Currently, support 512/1024/2048/4096 bytes sector size */
  2446		if (le32_to_cpu(raw_super->log_sectorsize) >
  2447					F2FS_MAX_LOG_SECTOR_SIZE ||
  2448			le32_to_cpu(raw_super->log_sectorsize) <
  2449					F2FS_MIN_LOG_SECTOR_SIZE) {
  2450			f2fs_msg(sb, KERN_INFO, "Invalid log sectorsize (%u)",
  2451				le32_to_cpu(raw_super->log_sectorsize));
  2452			return 1;
  2453		}
  2454		if (le32_to_cpu(raw_super->log_sectors_per_block) +
  2455			le32_to_cpu(raw_super->log_sectorsize) !=
  2456				F2FS_MAX_LOG_SECTOR_SIZE) {
  2457			f2fs_msg(sb, KERN_INFO,
  2458				"Invalid log sectors per block(%u) log sectorsize(%u)",
  2459				le32_to_cpu(raw_super->log_sectors_per_block),
  2460				le32_to_cpu(raw_super->log_sectorsize));
  2461			return 1;
  2462		}
  2463	
  2464		segment_count = le32_to_cpu(raw_super->segment_count);
  2465		segs_per_sec = le32_to_cpu(raw_super->segs_per_sec);
  2466		secs_per_zone = le32_to_cpu(raw_super->secs_per_zone);
  2467		total_sections = le32_to_cpu(raw_super->section_count);
  2468	
  2469		/* blocks_per_seg should be 512, given the above check */
  2470		blocks_per_seg = 1 << le32_to_cpu(raw_super->log_blocks_per_seg);
  2471	
  2472		if (segment_count > F2FS_MAX_SEGMENT ||
  2473					segment_count < F2FS_MIN_SEGMENTS) {
  2474			f2fs_msg(sb, KERN_INFO,
  2475				"Invalid segment count (%u)",
  2476				segment_count);
  2477			return 1;
  2478		}
  2479	
  2480		if (total_sections > segment_count ||
  2481				total_sections < F2FS_MIN_SEGMENTS ||
  2482				segs_per_sec > segment_count || !segs_per_sec) {
  2483			f2fs_msg(sb, KERN_INFO,
  2484				"Invalid segment/section count (%u, %u x %u)",
  2485				segment_count, total_sections, segs_per_sec);
  2486			return 1;
  2487		}
  2488	
  2489		if ((segment_count / segs_per_sec) < total_sections) {
  2490			f2fs_msg(sb, KERN_INFO,
  2491				"Small segment_count (%u < %u * %u)",
  2492				segment_count, segs_per_sec, total_sections);
  2493			return 1;
  2494		}
  2495	
  2496		if (segment_count > (le64_to_cpu(raw_super->block_count) >> 9)) {
  2497			f2fs_msg(sb, KERN_INFO,
  2498				"Wrong segment_count / block_count (%u > %u)",
> 2499				segment_count, le64_to_cpu(raw_super->block_count));
  2500			return 1;
  2501		}
  2502	
  2503		if (secs_per_zone > total_sections || !secs_per_zone) {
  2504			f2fs_msg(sb, KERN_INFO,
  2505				"Wrong secs_per_zone / total_sections (%u, %u)",
  2506				secs_per_zone, total_sections);
  2507			return 1;
  2508		}
  2509		if (le32_to_cpu(raw_super->extension_count) > F2FS_MAX_EXTENSION ||
  2510				raw_super->hot_ext_count > F2FS_MAX_EXTENSION ||
  2511				(le32_to_cpu(raw_super->extension_count) +
  2512				raw_super->hot_ext_count) > F2FS_MAX_EXTENSION) {
  2513			f2fs_msg(sb, KERN_INFO,
  2514				"Corrupted extension count (%u + %u > %u)",
  2515				le32_to_cpu(raw_super->extension_count),
  2516				raw_super->hot_ext_count,
  2517				F2FS_MAX_EXTENSION);
  2518			return 1;
  2519		}
  2520	
  2521		if (le32_to_cpu(raw_super->cp_payload) >
  2522					(blocks_per_seg - F2FS_CP_PACKS)) {
  2523			f2fs_msg(sb, KERN_INFO,
  2524				"Insane cp_payload (%u > %u)",
  2525				le32_to_cpu(raw_super->cp_payload),
  2526				blocks_per_seg - F2FS_CP_PACKS);
  2527			return 1;
  2528		}
  2529	
  2530		/* check reserved ino info */
  2531		if (le32_to_cpu(raw_super->node_ino) != 1 ||
  2532			le32_to_cpu(raw_super->meta_ino) != 2 ||
  2533			le32_to_cpu(raw_super->root_ino) != 3) {
  2534			f2fs_msg(sb, KERN_INFO,
  2535				"Invalid Fs Meta Ino: node(%u) meta(%u) root(%u)",
  2536				le32_to_cpu(raw_super->node_ino),
  2537				le32_to_cpu(raw_super->meta_ino),
  2538				le32_to_cpu(raw_super->root_ino));
  2539			return 1;
  2540		}
  2541	
  2542		/* check CP/SIT/NAT/SSA/MAIN_AREA area boundary */
  2543		if (sanity_check_area_boundary(sbi, bh))
  2544			return 1;
  2545	
  2546		return 0;
  2547	}
  2548	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30537 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] f2fs: fix validation of the block count in sanity_check_raw_super
@ 2018-12-22  9:30     ` kbuild test robot
  0 siblings, 0 replies; 12+ messages in thread
From: kbuild test robot @ 2018-12-22  9:30 UTC (permalink / raw)
  Cc: kbuild-all, linux-f2fs-devel, yuchao0, jaegeuk, linux-kernel,
	stable, Martin Blumenstingl

[-- Attachment #1: Type: text/plain, Size: 7291 bytes --]

Hi Martin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on f2fs/dev-test]
[also build test WARNING on v4.20-rc7 next-20181221]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Martin-Blumenstingl/f2fs-fix-sanity_check_raw_super-on-big-endian-machines/20181222-142616
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
config: i386-randconfig-a3-12211242 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   fs/f2fs/super.c: In function 'sanity_check_raw_super':
>> fs/f2fs/super.c:2499:4: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type '__le64' [-Wformat=]
       segment_count, le64_to_cpu(raw_super->block_count));
       ^

vim +2499 fs/f2fs/super.c

  2382	
  2383	static int sanity_check_raw_super(struct f2fs_sb_info *sbi,
  2384					struct buffer_head *bh)
  2385	{
  2386		block_t segment_count, segs_per_sec, secs_per_zone;
  2387		block_t total_sections, blocks_per_seg;
  2388		struct f2fs_super_block *raw_super = (struct f2fs_super_block *)
  2389						(bh->b_data + F2FS_SUPER_OFFSET);
  2390		struct super_block *sb = sbi->sb;
  2391		unsigned int blocksize;
  2392		size_t crc_offset = 0;
  2393		__u32 crc = 0;
  2394	
  2395		/* Check checksum_offset and crc in superblock */
  2396		if (__F2FS_HAS_FEATURE(raw_super, F2FS_FEATURE_SB_CHKSUM)) {
  2397			crc_offset = le32_to_cpu(raw_super->checksum_offset);
  2398			if (crc_offset !=
  2399				offsetof(struct f2fs_super_block, crc)) {
  2400				f2fs_msg(sb, KERN_INFO,
  2401					"Invalid SB checksum offset: %zu",
  2402					crc_offset);
  2403				return 1;
  2404			}
  2405			crc = le32_to_cpu(raw_super->crc);
  2406			if (!f2fs_crc_valid(sbi, crc, raw_super, crc_offset)) {
  2407				f2fs_msg(sb, KERN_INFO,
  2408					"Invalid SB checksum value: %u", crc);
  2409				return 1;
  2410			}
  2411		}
  2412	
  2413		if (F2FS_SUPER_MAGIC != le32_to_cpu(raw_super->magic)) {
  2414			f2fs_msg(sb, KERN_INFO,
  2415				"Magic Mismatch, valid(0x%x) - read(0x%x)",
  2416				F2FS_SUPER_MAGIC, le32_to_cpu(raw_super->magic));
  2417			return 1;
  2418		}
  2419	
  2420		/* Currently, support only 4KB page cache size */
  2421		if (F2FS_BLKSIZE != PAGE_SIZE) {
  2422			f2fs_msg(sb, KERN_INFO,
  2423				"Invalid page_cache_size (%lu), supports only 4KB\n",
  2424				PAGE_SIZE);
  2425			return 1;
  2426		}
  2427	
  2428		/* Currently, support only 4KB block size */
  2429		blocksize = 1 << le32_to_cpu(raw_super->log_blocksize);
  2430		if (blocksize != F2FS_BLKSIZE) {
  2431			f2fs_msg(sb, KERN_INFO,
  2432				"Invalid blocksize (%u), supports only 4KB\n",
  2433				blocksize);
  2434			return 1;
  2435		}
  2436	
  2437		/* check log blocks per segment */
  2438		if (le32_to_cpu(raw_super->log_blocks_per_seg) != 9) {
  2439			f2fs_msg(sb, KERN_INFO,
  2440				"Invalid log blocks per segment (%u)\n",
  2441				le32_to_cpu(raw_super->log_blocks_per_seg));
  2442			return 1;
  2443		}
  2444	
  2445		/* Currently, support 512/1024/2048/4096 bytes sector size */
  2446		if (le32_to_cpu(raw_super->log_sectorsize) >
  2447					F2FS_MAX_LOG_SECTOR_SIZE ||
  2448			le32_to_cpu(raw_super->log_sectorsize) <
  2449					F2FS_MIN_LOG_SECTOR_SIZE) {
  2450			f2fs_msg(sb, KERN_INFO, "Invalid log sectorsize (%u)",
  2451				le32_to_cpu(raw_super->log_sectorsize));
  2452			return 1;
  2453		}
  2454		if (le32_to_cpu(raw_super->log_sectors_per_block) +
  2455			le32_to_cpu(raw_super->log_sectorsize) !=
  2456				F2FS_MAX_LOG_SECTOR_SIZE) {
  2457			f2fs_msg(sb, KERN_INFO,
  2458				"Invalid log sectors per block(%u) log sectorsize(%u)",
  2459				le32_to_cpu(raw_super->log_sectors_per_block),
  2460				le32_to_cpu(raw_super->log_sectorsize));
  2461			return 1;
  2462		}
  2463	
  2464		segment_count = le32_to_cpu(raw_super->segment_count);
  2465		segs_per_sec = le32_to_cpu(raw_super->segs_per_sec);
  2466		secs_per_zone = le32_to_cpu(raw_super->secs_per_zone);
  2467		total_sections = le32_to_cpu(raw_super->section_count);
  2468	
  2469		/* blocks_per_seg should be 512, given the above check */
  2470		blocks_per_seg = 1 << le32_to_cpu(raw_super->log_blocks_per_seg);
  2471	
  2472		if (segment_count > F2FS_MAX_SEGMENT ||
  2473					segment_count < F2FS_MIN_SEGMENTS) {
  2474			f2fs_msg(sb, KERN_INFO,
  2475				"Invalid segment count (%u)",
  2476				segment_count);
  2477			return 1;
  2478		}
  2479	
  2480		if (total_sections > segment_count ||
  2481				total_sections < F2FS_MIN_SEGMENTS ||
  2482				segs_per_sec > segment_count || !segs_per_sec) {
  2483			f2fs_msg(sb, KERN_INFO,
  2484				"Invalid segment/section count (%u, %u x %u)",
  2485				segment_count, total_sections, segs_per_sec);
  2486			return 1;
  2487		}
  2488	
  2489		if ((segment_count / segs_per_sec) < total_sections) {
  2490			f2fs_msg(sb, KERN_INFO,
  2491				"Small segment_count (%u < %u * %u)",
  2492				segment_count, segs_per_sec, total_sections);
  2493			return 1;
  2494		}
  2495	
  2496		if (segment_count > (le64_to_cpu(raw_super->block_count) >> 9)) {
  2497			f2fs_msg(sb, KERN_INFO,
  2498				"Wrong segment_count / block_count (%u > %u)",
> 2499				segment_count, le64_to_cpu(raw_super->block_count));
  2500			return 1;
  2501		}
  2502	
  2503		if (secs_per_zone > total_sections || !secs_per_zone) {
  2504			f2fs_msg(sb, KERN_INFO,
  2505				"Wrong secs_per_zone / total_sections (%u, %u)",
  2506				secs_per_zone, total_sections);
  2507			return 1;
  2508		}
  2509		if (le32_to_cpu(raw_super->extension_count) > F2FS_MAX_EXTENSION ||
  2510				raw_super->hot_ext_count > F2FS_MAX_EXTENSION ||
  2511				(le32_to_cpu(raw_super->extension_count) +
  2512				raw_super->hot_ext_count) > F2FS_MAX_EXTENSION) {
  2513			f2fs_msg(sb, KERN_INFO,
  2514				"Corrupted extension count (%u + %u > %u)",
  2515				le32_to_cpu(raw_super->extension_count),
  2516				raw_super->hot_ext_count,
  2517				F2FS_MAX_EXTENSION);
  2518			return 1;
  2519		}
  2520	
  2521		if (le32_to_cpu(raw_super->cp_payload) >
  2522					(blocks_per_seg - F2FS_CP_PACKS)) {
  2523			f2fs_msg(sb, KERN_INFO,
  2524				"Insane cp_payload (%u > %u)",
  2525				le32_to_cpu(raw_super->cp_payload),
  2526				blocks_per_seg - F2FS_CP_PACKS);
  2527			return 1;
  2528		}
  2529	
  2530		/* check reserved ino info */
  2531		if (le32_to_cpu(raw_super->node_ino) != 1 ||
  2532			le32_to_cpu(raw_super->meta_ino) != 2 ||
  2533			le32_to_cpu(raw_super->root_ino) != 3) {
  2534			f2fs_msg(sb, KERN_INFO,
  2535				"Invalid Fs Meta Ino: node(%u) meta(%u) root(%u)",
  2536				le32_to_cpu(raw_super->node_ino),
  2537				le32_to_cpu(raw_super->meta_ino),
  2538				le32_to_cpu(raw_super->root_ino));
  2539			return 1;
  2540		}
  2541	
  2542		/* check CP/SIT/NAT/SSA/MAIN_AREA area boundary */
  2543		if (sanity_check_area_boundary(sbi, bh))
  2544			return 1;
  2545	
  2546		return 0;
  2547	}
  2548	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30537 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] f2fs: fix validation of the block count in sanity_check_raw_super
  2018-12-22  7:00     ` kbuild test robot
@ 2018-12-22 11:08       ` Martin Blumenstingl via Linux-f2fs-devel
  -1 siblings, 0 replies; 12+ messages in thread
From: Martin Blumenstingl @ 2018-12-22 11:08 UTC (permalink / raw)
  To: kbuild test robot
  Cc: kbuild-all, linux-f2fs-devel, yuchao0, jaegeuk, linux-kernel, stable

On Sat, Dec 22, 2018 at 8:00 AM kbuild test robot <lkp@intel.com> wrote:
>
> Hi Martin,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on f2fs/dev-test]
> [also build test WARNING on v4.20-rc7 next-20181221]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url:    https://github.com/0day-ci/linux/commits/Martin-Blumenstingl/f2fs-fix-sanity_check_raw_super-on-big-endian-machines/20181222-142616
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
> config: i386-randconfig-x006-201850 (attached as .config)
> compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=i386
>
> All warnings (new ones prefixed by >>):
>
>    fs/f2fs/super.c: In function 'sanity_check_raw_super':
> >> fs/f2fs/super.c:2498:46: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'long long unsigned int' [-Wformat=]
>        "Wrong segment_count / block_count (%u > %u)",
>                                                 ~^
>                                                 %llu
I sent a v2 with this fixed and Chao Yu's reviewed by included

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] f2fs: fix validation of the block count in sanity_check_raw_super
@ 2018-12-22 11:08       ` Martin Blumenstingl via Linux-f2fs-devel
  0 siblings, 0 replies; 12+ messages in thread
From: Martin Blumenstingl via Linux-f2fs-devel @ 2018-12-22 11:08 UTC (permalink / raw)
  To: kbuild test robot
  Cc: linux-kernel, stable, linux-f2fs-devel, kbuild-all, jaegeuk

On Sat, Dec 22, 2018 at 8:00 AM kbuild test robot <lkp@intel.com> wrote:
>
> Hi Martin,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on f2fs/dev-test]
> [also build test WARNING on v4.20-rc7 next-20181221]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url:    https://github.com/0day-ci/linux/commits/Martin-Blumenstingl/f2fs-fix-sanity_check_raw_super-on-big-endian-machines/20181222-142616
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
> config: i386-randconfig-x006-201850 (attached as .config)
> compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=i386
>
> All warnings (new ones prefixed by >>):
>
>    fs/f2fs/super.c: In function 'sanity_check_raw_super':
> >> fs/f2fs/super.c:2498:46: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'long long unsigned int' [-Wformat=]
>        "Wrong segment_count / block_count (%u > %u)",
>                                                 ~^
>                                                 %llu
I sent a v2 with this fixed and Chao Yu's reviewed by included

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] f2fs: fix validation of the block count in sanity_check_raw_super
  2018-12-22 11:08       ` Martin Blumenstingl via Linux-f2fs-devel
@ 2018-12-24  8:18         ` Chao Yu
  -1 siblings, 0 replies; 12+ messages in thread
From: Chao Yu @ 2018-12-24  8:18 UTC (permalink / raw)
  To: Martin Blumenstingl, kbuild test robot
  Cc: kbuild-all, linux-f2fs-devel, jaegeuk, linux-kernel, stable

On 2018/12/22 19:08, Martin Blumenstingl wrote:
> On Sat, Dec 22, 2018 at 8:00 AM kbuild test robot <lkp@intel.com> wrote:
>>
>> Hi Martin,
>>
>> Thank you for the patch! Perhaps something to improve:
>>
>> [auto build test WARNING on f2fs/dev-test]
>> [also build test WARNING on v4.20-rc7 next-20181221]
>> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>>
>> url:    https://github.com/0day-ci/linux/commits/Martin-Blumenstingl/f2fs-fix-sanity_check_raw_super-on-big-endian-machines/20181222-142616
>> base:   https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
>> config: i386-randconfig-x006-201850 (attached as .config)
>> compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
>> reproduce:
>>         # save the attached .config to linux build tree
>>         make ARCH=i386
>>
>> All warnings (new ones prefixed by >>):
>>
>>    fs/f2fs/super.c: In function 'sanity_check_raw_super':
>>>> fs/f2fs/super.c:2498:46: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'long long unsigned int' [-Wformat=]
>>        "Wrong segment_count / block_count (%u > %u)",
>>                                                 ~^
>>                                                 %llu
> I sent a v2 with this fixed and Chao Yu's reviewed by included

Sorry, I didn't catch previous print issue on v1, anyway, I'm okay with v2. :)

Thanks,

> 
> .
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/1] f2fs: fix validation of the block count in sanity_check_raw_super
@ 2018-12-24  8:18         ` Chao Yu
  0 siblings, 0 replies; 12+ messages in thread
From: Chao Yu @ 2018-12-24  8:18 UTC (permalink / raw)
  To: Martin Blumenstingl, kbuild test robot
  Cc: kbuild-all, linux-f2fs-devel, jaegeuk, linux-kernel, stable

On 2018/12/22 19:08, Martin Blumenstingl wrote:
> On Sat, Dec 22, 2018 at 8:00 AM kbuild test robot <lkp@intel.com> wrote:
>>
>> Hi Martin,
>>
>> Thank you for the patch! Perhaps something to improve:
>>
>> [auto build test WARNING on f2fs/dev-test]
>> [also build test WARNING on v4.20-rc7 next-20181221]
>> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>>
>> url:    https://github.com/0day-ci/linux/commits/Martin-Blumenstingl/f2fs-fix-sanity_check_raw_super-on-big-endian-machines/20181222-142616
>> base:   https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
>> config: i386-randconfig-x006-201850 (attached as .config)
>> compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
>> reproduce:
>>         # save the attached .config to linux build tree
>>         make ARCH=i386
>>
>> All warnings (new ones prefixed by >>):
>>
>>    fs/f2fs/super.c: In function 'sanity_check_raw_super':
>>>> fs/f2fs/super.c:2498:46: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'long long unsigned int' [-Wformat=]
>>        "Wrong segment_count / block_count (%u > %u)",
>>                                                 ~^
>>                                                 %llu
> I sent a v2 with this fixed and Chao Yu's reviewed by included

Sorry, I didn't catch previous print issue on v1, anyway, I'm okay with v2. :)

Thanks,

> 
> .
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-12-24  8:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-21 19:28 [PATCH 0/1] f2fs: fix sanity_check_raw_super on big endian machines Martin Blumenstingl
2018-12-21 19:28 ` [PATCH 1/1] f2fs: fix validation of the block count in sanity_check_raw_super Martin Blumenstingl
2018-12-22  2:24   ` Chao Yu
2018-12-22  2:24     ` Chao Yu
2018-12-22  7:00   ` kbuild test robot
2018-12-22  7:00     ` kbuild test robot
2018-12-22 11:08     ` Martin Blumenstingl
2018-12-22 11:08       ` Martin Blumenstingl via Linux-f2fs-devel
2018-12-24  8:18       ` Chao Yu
2018-12-24  8:18         ` Chao Yu
2018-12-22  9:30   ` kbuild test robot
2018-12-22  9:30     ` kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.