Skip to contentSkip to conversation

f2fs: check the right return value of memory alloc function

PATCH In review Yunlei He 2 participants 2 messages Jul 2, 2018 F2FS file system

lore
Share & tools
lore

Yunlei He

author
#0 lore raw

PATCH 1/1 f2fs: check the right return value of memory alloc function

This patch check the right return value of memory alloc function

---
 fs/f2fs/node.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/node.c +1 -1
index 1af61e0..24b5262 100644
@@ -2794,7 +2794,7 @@ static int init_free_nid_cache(struct f2fs_sb_info *sbi)
 	for (i = 0; i < nm_i->nat_blocks; i++) {
 		nm_i->free_nid_bitmap[i] = f2fs_kvzalloc(sbi,
 				NAT_ENTRY_BITMAP_SIZE_ALIGNED, GFP_KERNEL);
-		if (!nm_i->free_nid_bitmap)
+		if (!nm_i->free_nid_bitmap[i])
 			return -ENOMEM;
 	}
 
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