If inode->nid is less than 0, it should be unallocated nid as well.
Reported-by: Jingbo Xu <[email protected]>
Fixes: 21d84349e79a ("erofs-utils: rearrange on-disk metadata")
Signed-off-by: Gao Xiang <[email protected]>
---
lib/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/inode.c b/lib/inode.c
index e2b02c4..54ea5fa 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -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);
--
2.24.4