bcachefs: darray: Don't pass NULL to memcpy()
memcpy's second parameter must not be NULL, even if size is zero. Signed-off-by: Tavian Barnes <tavianator@tavianator.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
efb2018e4d
commit
2e118ba36d
@ -13,7 +13,8 @@ int __bch2_darray_resize(darray_char *d, size_t element_size, size_t new_size, g
|
||||
if (!data)
|
||||
return -ENOMEM;
|
||||
|
||||
memcpy(data, d->data, d->size * element_size);
|
||||
if (d->size)
|
||||
memcpy(data, d->data, d->size * element_size);
|
||||
if (d->data != d->preallocated)
|
||||
kvfree(d->data);
|
||||
d->data = data;
|
||||
|
Loading…
Reference in New Issue
Block a user