summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2021-07-01 04:56:01 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2021-07-01 21:06:05 +0300
commit1a58be6277e4324c853babfd35890c2d5e171e8f (patch)
tree066d8698cae0b90448aa04517bc2ad65a5911c99 /lib
parent478485f6c0e5936b62c0c9393a865bfb00f037a5 (diff)
downloadlinux-1a58be6277e4324c853babfd35890c2d5e171e8f.tar.xz
lib: memscan() fixlet
Generic version doesn't trucate second argument to char. Older brother memchr() does as do s390, sparc and i386 assembly versions. Fortunately, no code passes c >= 256. Link: https://lkml.kernel.org/r/YLv4cCf0t5UPdyK+@localhost.localdomain Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/string.c b/lib/string.c
index 7548eb715ddb..77bd0b1d3296 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -977,7 +977,7 @@ void *memscan(void *addr, int c, size_t size)
unsigned char *p = addr;
while (size) {
- if (*p == c)
+ if (*p == (unsigned char)c)
return (void *)p;
p++;
size--;