git: ab77c26d3643 - main - linuxkpi: Add `mem_is_zero()`

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Wed, 22 Apr 2026 18:10:21 UTC
The branch main has been updated by dumbbell:

URL: https://cgit.FreeBSD.org/src/commit/?id=ab77c26d3643b88b29d3526d60b939d1cca402f9

commit ab77c26d3643b88b29d3526d60b939d1cca402f9
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-22 18:09:54 +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
    Differential Revision: https://reviews.freebsd.org/D56442
---
 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)
 {