Linux-f2fs-devel Archive on lore.kernel.org
 help / color / Atom feed
* [f2fs-dev] [PATCH] f2fs: update_sit_entry: Make the judgment condition of f2fs_bug_on more intuitive
@ 2020-08-01  3:24 Zhihao Cheng
  2020-08-04  0:57 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Zhihao Cheng @ 2020-08-01  3:24 UTC (permalink / raw)
  To: jaegeuk, chao, yi.zhang; +Cc: linux-kernel, linux-f2fs-devel

Current judgment condition of f2fs_bug_on in function update_sit_entry():
  new_vblocks >> (sizeof(unsigned short) << 3) ||
	new_vblocks > sbi->blocks_per_seg

which equivalents to:
  new_vblocks < 0 || new_vblocks > sbi->blocks_per_seg

The latter is more intuitive.

Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Reported-by: Jack Qiu <jack.qiu@huawei.com>
---
 fs/f2fs/segment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 196f31503511..41836447418d 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2140,7 +2140,7 @@ static void update_sit_entry(struct f2fs_sb_info *sbi, block_t blkaddr, int del)
 	new_vblocks = se->valid_blocks + del;
 	offset = GET_BLKOFF_FROM_SEG0(sbi, blkaddr);
 
-	f2fs_bug_on(sbi, (new_vblocks >> (sizeof(unsigned short) << 3) ||
+	f2fs_bug_on(sbi, (new_vblocks < 0 ||
 				(new_vblocks > sbi->blocks_per_seg)));
 
 	se->valid_blocks = new_vblocks;
-- 
2.25.4



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH] f2fs: update_sit_entry: Make the judgment condition of f2fs_bug_on more intuitive
  2020-08-01  3:24 [f2fs-dev] [PATCH] f2fs: update_sit_entry: Make the judgment condition of f2fs_bug_on more intuitive Zhihao Cheng
@ 2020-08-04  0:57 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2020-08-04  0:57 UTC (permalink / raw)
  To: Zhihao Cheng, jaegeuk, chao, yi.zhang; +Cc: linux-kernel, linux-f2fs-devel

On 2020/8/1 11:24, Zhihao Cheng wrote:
> Current judgment condition of f2fs_bug_on in function update_sit_entry():
>    new_vblocks >> (sizeof(unsigned short) << 3) ||
> 	new_vblocks > sbi->blocks_per_seg
> 
> which equivalents to:
>    new_vblocks < 0 || new_vblocks > sbi->blocks_per_seg
> 
> The latter is more intuitive.
> 
> Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
> Reported-by: Jack Qiu <jack.qiu@huawei.com>

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

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-01  3:24 [f2fs-dev] [PATCH] f2fs: update_sit_entry: Make the judgment condition of f2fs_bug_on more intuitive Zhihao Cheng
2020-08-04  0:57 ` Chao Yu

Linux-f2fs-devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-f2fs-devel/0 linux-f2fs-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-f2fs-devel linux-f2fs-devel/ https://lore.kernel.org/linux-f2fs-devel \
		linux-f2fs-devel@lists.sourceforge.net
	public-inbox-index linux-f2fs-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/net.sourceforge.lists.linux-f2fs-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git