projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bbfcb45
)
bcachefs: Fix a memcpy call
author
Kent Overstreet
<kent.overstreet@gmail.com>
Mon, 17 May 2021 20:10:06 +0000
(16:10 -0400)
committer
Kent Overstreet
<kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:03 +0000
(17:09 -0400)
Not supposed to pass a null ptr to memcpy (even if the size is 0).
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/fsck.c
patch
|
blob
|
history
diff --git
a/fs/bcachefs/fsck.c
b/fs/bcachefs/fsck.c
index fcdcf42f85a4783eb3b19d81e9fb9d074385e980..a40459d2b0f06b369d1baae25aad6cd59d33485e 100644
(file)
--- 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;