Call trace:
 - erofs_mkfs_build_tree
  - erofs_mkfs_go(sbi, ~0, NULL, 0);

inode.c:1395:20: runtime error: null pointer passed as argument 2, which is 
declared to never be null
/usr/include/string.h:44:28: note: nonnull attribute specified here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior inode.c:1395:20 in

Signed-off-by: Gao Xiang <[email protected]>
---
 lib/inode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/inode.c b/lib/inode.c
index 128c051..d464bc6 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -1392,7 +1392,8 @@ static int erofs_mkfs_go(struct erofs_sb_info *sbi,
 
        item = q->queue + q->tail;
        item->type = type;
-       memcpy(&item->u, elem, size);
+       if (size)
+               memcpy(&item->u, elem, size);
        q->tail = (q->tail + 1) & (q->entries - 1);
        q->idle = false;
 
-- 
2.43.5

Reply via email to