git: 026509a6bc7a - stable/15 - linuxkpi: Add `mem_is_zero()`
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 29 Apr 2026 21:42:58 UTC
The branch stable/15 has been updated by dumbbell:
URL: https://cgit.FreeBSD.org/src/commit/?id=026509a6bc7a350cc1b241cf2acb40b5ba8876a8
commit 026509a6bc7a350cc1b241cf2acb40b5ba8876a8
Author: Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2026-04-12 10:16:55 +0000
Commit: Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2026-04-29 21:03:45 +0000
linuxkpi: Add `mem_is_zero()`
The DRM generic code and the i915 DRM driver started to replace the use
of `memchr_inv()` by a `mem_is_zero()` in Linux 6.12. We reuse the
previous use of `memchr_inv()` to implement `mem_is_zero()`.
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
(cherry picked from commit ab77c26d3643b88b29d3526d60b939d1cca402f9)
---
sys/compat/linuxkpi/common/include/linux/string.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sys/compat/linuxkpi/common/include/linux/string.h b/sys/compat/linuxkpi/common/include/linux/string.h
index 0b858e7af623..8ca20df27792 100644
--- a/sys/compat/linuxkpi/common/include/linux/string.h
+++ b/sys/compat/linuxkpi/common/include/linux/string.h
@@ -198,6 +198,12 @@ memchr_inv(const void *start, int c, size_t length)
return (NULL);
}
+static inline bool
+mem_is_zero(const void *start, size_t length)
+{
+ return (memchr_inv(start, 0, length) == NULL);
+}
+
static inline size_t
str_has_prefix(const char *str, const char *prefix)
{