diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2022-01-31 08:57:14 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-01-31 10:58:33 +0100 |
commit | f26f76f66daa87fc619c7245896b8bb9d37fe7d3 (patch) | |
tree | 80dd94239cfbf000e34009dc4b29851dfb485829 | |
parent | 65683428c113c9fe114e2f89aa5e9b8909534a43 (diff) | |
download | barebox-f26f76f66daa87fc619c7245896b8bb9d37fe7d3.tar.gz barebox-f26f76f66daa87fc619c7245896b8bb9d37fe7d3.tar.xz |
string: define new memdup_array
This will come in handy later for duplicating parent arrays when doing
clock registration.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20220131075725.1873026-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | include/linux/string.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/string.h b/include/linux/string.h index 3da174116a..ae5e5bca8d 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -5,6 +5,7 @@ #include <linux/types.h> /* for size_t */ #include <linux/stddef.h> /* for NULL */ +#include <linux/overflow.h> /* for array_size */ #ifdef __cplusplus extern "C" { @@ -133,6 +134,8 @@ static inline const char *kbasename(const char *path) void *memdup(const void *, size_t); +#define memdup_array(arr, count) memdup(arr, array_size(count, sizeof(*arr))); + static inline void *kmemdup(const void *src, size_t len, gfp_t gfp) { return memdup(src, len); |