[PATCH 01/12] string: define new memdup_array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This will come in handy later for duplicating parent arrays when doing
clock registration.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 include/linux/string.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/string.h b/include/linux/string.h
index 3da174116a92..ae5e5bca8d24 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);
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux