Commit 2e118ba3 authored by Tavian Barnes's avatar Tavian Barnes Committed by Kent Overstreet
Browse files

bcachefs: darray: Don't pass NULL to memcpy()



memcpy's second parameter must not be NULL, even if size is zero.

Signed-off-by: default avatarTavian Barnes <tavianator@tavianator.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent efb2018e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ int __bch2_darray_resize(darray_char *d, size_t element_size, size_t new_size, g
		if (!data)
			return -ENOMEM;

		if (d->size)
			memcpy(data, d->data, d->size * element_size);
		if (d->data != d->preallocated)
			kvfree(d->data);