Skip to contentSkip to conversation

erofs-utils: fix nid lookup for packed inode

PATCH New Gao Xiang 1 participant 1 message Apr 3, 2023 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: fix nid lookup for packed inode

If inode->nid is less than 0, it should be unallocated nid as well.

Fixes 21d84349e79a ("erofs-utils: rearrange on-disk metadata")
---
 lib/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/inode.c +1 -1
index e2b02c4..54ea5fa 100644
@@ -288,7 +288,7 @@ erofs_nid_t erofs_lookupnid(struct erofs_inode *inode)
 	struct erofs_buffer_head *const bh = inode->bh;
 	erofs_off_t off, meta_offset;
 
-	if (!bh || inode->nid)
+	if (!bh || (long long)inode->nid > 0)
 		return inode->nid;
 
 	erofs_mapbh(bh->block);
Signature · 1 line
2.24.4