mirror of
https://github.com/torvalds/linux.git
synced 2024-12-29 14:21:47 +00:00
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>
This commit is contained in:
parent
478485f6c0
commit
1a58be6277
@ -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--;
|
||||
|
Loading…
Reference in New Issue
Block a user