Skip to contentSkip to conversation

fsck: fix missing endian conversion

PATCH In review Yunlei He 2 participants 4 messages Jan 26, 2018 – Jan 27, 2018

lore
Share & tools
lore

Yunlei He

author
#0 lore raw

PATCH 1/1 fsck: fix missing endian conversion

This patch fix missing endian conversion in function build_nat_area_bitmap

---
 fsck/mount.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fsck/mount.c +1 -1
index fe0d510..5289a1b 100644
@@ -2225,7 +2225,7 @@ void build_nat_area_bitmap(struct f2fs_sb_info *sbi)
 		if (fsck->entries[nid].block_addr != 0x0) {
 			fsck->chk.valid_nat_entry_cnt--;
 			f2fs_clear_bit(nid, fsck->nat_area_bitmap);
-			if (fsck->entries[nid].ino == nid)
+			if (le32_to_cpu(fsck->entries[nid].ino) == nid)
 				fsck->nat_valid_inode_cnt--;
 		}
 
Signature · 6 lines
1.9.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
#1 lore raw
Quoted 2 lines · Yunlei He

This patch fix missing endian conversion in function build_nat_area_bitmap

I note that there are some missing cases for f2fs_nat_entry::blocik_addr, how about fixing them in this patch too?

Thanks,

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

author
#2 lore raw
Quoted 9 lines

-----Original Message-----
From: Yuchao (T)
Sent: Saturday, January 27, 2018 11:30 AM
To: heyunlei; [email protected]; [email protected]
Cc: Wangbintian; Jianing (Euler)
Subject: Re: [f2fs-dev][PATCH] fsck: fix missing endian conversion

Quoted 6 lines
Quoted 2 lines · Yunlei He

This patch fix missing endian conversion in function build_nat_area_bitmap

I note that there are some missing cases for f2fs_nat_entry::blocik_addr, how about fixing them in this patch too?

2224 /* Clear the original bit and count */
2225 if (fsck->entries[nid].block_addr != 0x0) {

You mean here? I checked the whole function and found only here exist this problem. Because of comparing with zero, so I didn't change here in previous patch.

Thanks.

2226                         fsck->chk.valid_nat_entry_cnt--;
2227                         f2fs_clear_bit(nid, fsck->nat_area_bitmap);
2228                         if (le32_to_cpu(fsck->entries[nid].ino) == nid)

2229 fsck->nat_valid_inode_cnt--;
2230 }

Quoted 2 lines

Thanks,

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

#3 lore raw
Quoted 16 lines · heyunlei
Quoted 9 lines

-----Original Message-----
From: Yuchao (T)
Sent: Saturday, January 27, 2018 11:30 AM
To: heyunlei; [email protected]; [email protected]
Cc: Wangbintian; Jianing (Euler)
Subject: Re: [f2fs-dev][PATCH] fsck: fix missing endian conversion

Quoted 6 lines
Quoted 2 lines · Yunlei He

This patch fix missing endian conversion in function build_nat_area_bitmap

I note that there are some missing cases for f2fs_nat_entry::blocik_addr, how about fixing them in this patch too?

Quoted 6 lines

2224 /* Clear the original bit and count */
2225 if (fsck->entries[nid].block_addr != 0x0) {

You mean here? I checked the whole function and found only here exist this problem. Because of comparing with zero, so I didn't change here in previous patch.

Yes, how about just using if (f2fs_nat_entry::blocik_addr) in both write_nat_bits and build_nat_area_bitmap.

Thanks,

Quoted 6 lines

Thanks.

2226                         fsck->chk.valid_nat_entry_cnt--;
2227                         f2fs_clear_bit(nid, fsck->nat_area_bitmap);
2228                         if (le32_to_cpu(fsck->entries[nid].ino) == nid)
Quoted 9 lines

2229 fsck->nat_valid_inode_cnt--;
2230 }

Quoted 2 lines

Thanks,

.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot