Skip to content

Commit 8c5fb8e

Browse files
mitatorvalds
authored andcommitted
mm/debug-pagealloc.c: use memchr_inv
Use newly introduced memchr_inv() for page verification. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 7982482 commit 8c5fb8e

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

‎mm/debug-pagealloc.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <linux/kernel.h>
2+
#include <linux/string.h>
23
#include <linux/mm.h>
34
#include <linux/page-debug-flags.h>
45
#include <linux/poison.h>
@@ -64,11 +65,8 @@ static void check_poison_mem(unsigned char *mem, size_t bytes)
6465
unsigned char *start;
6566
unsigned char *end;
6667

67-
for (start = mem; start < mem + bytes; start++) {
68-
if (*start != PAGE_POISON)
69-
break;
70-
}
71-
if (start == mem + bytes)
68+
start = memchr_inv(mem, PAGE_POISON, bytes);
69+
if (!start)
7270
return;
7371

7472
for (end = mem + bytes - 1; end > start; end--) {

0 commit comments

Comments
 (0)