[PATCH 6/7] include: linux/slab.h: define krealloc/kstrdup

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Jan 9 07:11:51 PST 2023


We already have a number of stubs for other kmalloc* functions, so add
these two as well.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 include/linux/slab.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/linux/slab.h b/include/linux/slab.h
index eb14c58e340f..dc80808938f4 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -3,6 +3,9 @@
 #ifndef _LINUX_SLAB_H
 #define _LINUX_SLAB_H
 
+#include <malloc.h>
+#include <linux/string.h>
+
 #define SLAB_CONSISTENCY_CHECKS	0
 #define SLAB_RED_ZONE		0
 #define SLAB_POISON		0
@@ -103,6 +106,16 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
 	return calloc(n, size);
 }
 
+static inline void *krealloc(void *ptr, size_t size, gfp_t flags)
+{
+	return realloc(ptr, size);
+}
+
+static inline char *kstrdup(const char *str, gfp_t flags)
+{
+	return strdup(str);
+}
+
 #define kstrdup_const(str, flags) strdup(str)
 #define kfree_const(ptr) kfree((void *)ptr)
 
-- 
2.30.2




More information about the barebox mailing list