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 <kent.overstreet@gmail.com>
This commit is contained in:
Kent Overstreet 2021-05-17 16:10:06 -04:00 committed by Kent Overstreet
parent bbfcb4519d
commit 82355e2882

View File

@ -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;