summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2023-01-09 16:11:51 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2023-01-10 15:59:54 +0100
commitb4bb285381bb80cae18fe67e3a0e425ca810cb0f (patch)
tree9c4c447c3f230f5ef62f206fc12da861b16831b5 /include/linux
parent29b3c5b1b6cb4dc917f0f76adfd248a6314707fa (diff)
downloadbarebox-b4bb285381bb80cae18fe67e3a0e425ca810cb0f.tar.gz
include: linux/slab.h: define krealloc/kstrdup
We already have a number of stubs for other kmalloc* functions, so add these two as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230109151152.2052493-7-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/slab.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h
index eb14c58e34..dc80808938 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)