public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] string: Group zero related memory APIs in the header
@ 2026-04-22 15:58 Andy Shevchenko
  0 siblings, 0 replies; only message in thread
From: Andy Shevchenko @ 2026-04-22 15:58 UTC (permalink / raw)
  To: Andy Shevchenko, linux-hardening, linux-kernel; +Cc: Kees Cook, Andy Shevchenko

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@linux.intel.com>
---
 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-22 15:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-22 15:58 [PATCH v1 1/1] string: Group zero related memory APIs in the header Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox