All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] erofs-utils: fix nid lookup for packed inode
@ 2023-04-03  8:38 Gao Xiang
  0 siblings, 0 replies; only message in thread
From: Gao Xiang @ 2023-04-03  8:38 UTC (permalink / raw)
  To: linux-erofs; +Cc: Gao Xiang

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

Reported-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Fixes: 21d84349e79a ("erofs-utils: rearrange on-disk metadata")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-03  8:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-03  8:38 [PATCH] erofs-utils: fix nid lookup for packed inode Gao Xiang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.