aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <dumbbell@FreeBSD.org>2026-04-12 10:16:55 +0000
committerJean-Sébastien Pédron <dumbbell@FreeBSD.org>2026-04-22 18:09:54 +0000
commitab77c26d3643b88b29d3526d60b939d1cca402f9 (patch)
tree91089566cf477433c3c8d7e89ec8c2b5ad7399d4
parent373871696d3da5f9fe1dcd23c83be95dbaa1b41d (diff)
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 Differential Revision: https://reviews.freebsd.org/D56442
-rw-r--r--sys/compat/linuxkpi/common/include/linux/string.h6
1 files changed, 6 insertions, 0 deletions
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)
{