diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-06-30 16:35:37 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2022-10-14 04:59:38 -0400 |
commit | 29f20baecf850c6381a48ceb57dcefac8e15bd5b (patch) | |
tree | 0436e075bd8499e67ae70887e3b7b1ee6f823394 /fs/bcachefs/darray.h | |
parent | d91a7b6ebca99e6140c913038614f153bc4d4610 (diff) |
bcachefs: Fixes for 4.19bcachefs-v4.19-backport-2.0
Diffstat (limited to 'fs/bcachefs/darray.h')
-rw-r--r-- | fs/bcachefs/darray.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/bcachefs/darray.h b/fs/bcachefs/darray.h index 519ab9b96e67..6de0c1c8ae36 100644 --- a/fs/bcachefs/darray.h +++ b/fs/bcachefs/darray.h @@ -11,6 +11,19 @@ #include "util.h" #include <linux/slab.h> +static inline void * __must_check krealloc_array(void *p, + size_t new_n, + size_t new_size, + gfp_t flags) +{ + size_t bytes; + + if (unlikely(check_mul_overflow(new_n, new_size, &bytes))) + return NULL; + + return krealloc(p, bytes, flags); +} + #define DARRAY(type) \ struct { \ size_t nr, size; \ |