[PATCH master 12/23] include: linux/slab: retire krealloc

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Apr 23 23:40:47 PDT 2024


We have no users of this function in-tree, so it doesn't make sense to
invest the work to make it DMA compatible at the present.

Therefore, let's just remove it.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 include/linux/device.h | 2 --
 include/linux/slab.h   | 5 -----
 lib/kasan/test_kasan.c | 4 ++--
 3 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/include/linux/device.h b/include/linux/device.h
index d892a9cb0ef5..66294910abb3 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -12,13 +12,11 @@
 #define __devm_wrapper(fn, dev, ...) ({ BUG_ON(!dev); fn(__VA_ARGS__); })
 
 #define devm_kmalloc(...)		__devm_wrapper(kmalloc, __VA_ARGS__)
-#define devm_krealloc(...)		__devm_wrapper(krealloc, __VA_ARGS__)
 #define devm_kvasprintf(...)		__devm_wrapper(kvasprintf, __VA_ARGS__)
 #define devm_kasprintf(...)		__devm_wrapper(kasprintf, __VA_ARGS__)
 #define devm_kzalloc(...)		__devm_wrapper(kzalloc, __VA_ARGS__)
 #define devm_kmalloc_array(...)		__devm_wrapper(kmalloc_array, __VA_ARGS__)
 #define devm_kcalloc(...)		__devm_wrapper(kcalloc, __VA_ARGS__)
-#define devm_krealloc_array(...)	__devm_wrapper(krealloc_array, __VA_ARGS__)
 #define devm_kfree(...)			__devm_wrapper(kfree, __VA_ARGS__)
 #define devm_kstrdup(...)		__devm_wrapper(kstrdup, __VA_ARGS__)
 #define devm_kstrdup_const(...)		__devm_wrapper(kstrdup_const, __VA_ARGS__)
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 47b0aec7e3b8..eba3593d758a 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -107,11 +107,6 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
 	return dma_zalloc(size_mul(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);
diff --git a/lib/kasan/test_kasan.c b/lib/kasan/test_kasan.c
index a74251a6d9ad..bacc02b56e98 100644
--- a/lib/kasan/test_kasan.c
+++ b/lib/kasan/test_kasan.c
@@ -69,7 +69,7 @@ static noinline void malloc_oob_realloc_more(void)
 	size_t size1 = 17;
 	size_t size2 = 19;
 
-	pr_info("out-of-bounds after krealloc more\n");
+	pr_info("out-of-bounds after realloc more\n");
 	ptr1 = malloc(size1);
 	ptr2 = realloc(ptr1, size2);
 	if (!ptr1 || !ptr2) {
@@ -92,7 +92,7 @@ static noinline void malloc_oob_realloc_less(void)
 	size_t size1 = 17;
 	size_t size2 = 15;
 
-	pr_info("out-of-bounds after krealloc less\n");
+	pr_info("out-of-bounds after realloc less\n");
 	ptr1 = malloc(size1);
 	ptr2 = realloc(ptr1, size2);
 	if (!ptr1 || !ptr2) {
-- 
2.39.2




More information about the barebox mailing list