From: Kent Overstreet Date: Mon, 17 May 2021 20:10:06 +0000 (-0400) Subject: bcachefs: Fix a memcpy call X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=82355e2882339067e1d6deaec68e629f63259c0d;p=linux.git bcachefs: Fix a memcpy call Not supposed to pass a null ptr to memcpy (even if the size is 0). Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c index fcdcf42f85a47..a40459d2b0f06 100644 --- a/fs/bcachefs/fsck.c +++ b/fs/bcachefs/fsck.c @@ -1161,7 +1161,8 @@ static int add_nlink(struct nlink_table *t, u64 inum, u32 snapshot) return -ENOMEM; } - memcpy(d, t->d, t->size * sizeof(t->d[0])); + if (t->d) + memcpy(d, t->d, t->size * sizeof(t->d[0])); kvfree(t->d); t->d = d;