[PATCH v1 1/1] string: Group zero related memory APIs in the header
From: Andy Shevchenko
Date: Wed Apr 22 2026 - 11:59:31 EST
Move mem_is_zero() closer to memzero_explicit() to group semantically
close APIs in the header for better browsing experience. No functional
changes.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
include/linux/string.h | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/include/linux/string.h b/include/linux/string.h
index b850bd91b3d8..3840be921d79 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -284,18 +284,6 @@ static inline void memcpy_flushcache(void *dst, const void *src, size_t cnt)
void *memchr_inv(const void *s, int c, size_t n);
char *strreplace(char *str, char old, char new);
-/**
- * mem_is_zero - Check if an area of memory is all 0's.
- * @s: The memory area
- * @n: The size of the area
- *
- * Return: True if the area of memory is all 0's.
- */
-static inline bool mem_is_zero(const void *s, size_t n)
-{
- return !memchr_inv(s, 0, n);
-}
-
extern void kfree_const(const void *x);
extern char *kstrdup(const char *s, gfp_t gfp) __malloc;
@@ -367,6 +355,18 @@ static inline void memzero_explicit(void *s, size_t count)
barrier_data(s);
}
+/**
+ * mem_is_zero - Check if an area of memory is all 0's.
+ * @s: The memory area
+ * @n: The size of the area
+ *
+ * Return: True if the area of memory is all 0's.
+ */
+static inline bool mem_is_zero(const void *s, size_t n)
+{
+ return !memchr_inv(s, 0, n);
+}
+
/**
* kbasename - return the last part of a pathname.
*
--
2.50.1