* + lib-string-fix-memchr_inv-for-large-ranges.patch added to mm-nonmm-unstable branch
@ 2026-06-25 1:25 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-06-25 1:25 UTC (permalink / raw)
To: mm-commits, penberg, kees, joern, cl, andy, akinobu.mita, include,
akpm
The patch titled
Subject: lib/string: fix memchr_inv() for large ranges
has been added to the -mm mm-nonmm-unstable branch. Its filename is
lib-string-fix-memchr_inv-for-large-ranges.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/lib-string-fix-memchr_inv-for-large-ranges.patch
This patch will later appear in the mm-nonmm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Bradley Morgan <include@grrlz.net>
Subject: lib/string: fix memchr_inv() for large ranges
Date: Sun, 21 Jun 2026 12:11:33 +0000
memchr_inv() takes a size_t length but counts 8 byte words in an unsigned
int. At 32GiB that count wraps, so the scan can quietly miss most of the
range.
Use size_t for the word count.
Link: https://lore.kernel.org/20260621121133.16460-1-include@grrlz.net
Fixes: 798248206b59 ("lib/string.c: introduce memchr_inv()")
Signed-off-by: Bradley Morgan <include@grrlz.net>
Cc: Akinbou Mita <akinobu.mita@gmail.com>
Cc: Andy Shevchenko <andy@kernel.org>
Cc: Christoph Lameer <cl@linux-foundation.org>
Cc: Joern Engel <joern@logfs.org>
Cc: Kees Cook <kees@kernel.org>
Cc: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
lib/string.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/lib/string.c~lib-string-fix-memchr_inv-for-large-ranges
+++ a/lib/string.c
@@ -821,7 +821,8 @@ void *memchr_inv(const void *start, int
{
u8 value = c;
u64 value64;
- unsigned int words, prefix;
+ size_t words;
+ unsigned int prefix;
if (bytes <= 16)
return check_bytes8(start, value, bytes);
_
Patches currently in -mm which might be from include@grrlz.net are
lib-string-fix-memchr_inv-for-large-ranges.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-06-25 1:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-25 1:25 + lib-string-fix-memchr_inv-for-large-ranges.patch added to mm-nonmm-unstable branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.