Skip to content

Commit

Permalink
kcsan: selftest: Ensure that address is at least PAGE_SIZE
Browse files Browse the repository at this point in the history
In preparation of supporting only addresses not within the NULL page,
change the selftest to never use addresses that are less than PAGE_SIZE.

Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
  • Loading branch information
Marco Elver authored and Paul E. McKenney committed Nov 3, 2020
1 parent 3650b22 commit 4761612
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kernel/kcsan/selftest.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ static bool test_encode_decode(void)
unsigned long addr;

prandom_bytes(&addr, sizeof(addr));
if (addr < PAGE_SIZE)
addr = PAGE_SIZE;

if (WARN_ON(!check_encodable(addr, size)))
return false;

Expand Down

0 comments on commit 4761612

Please sign in to comment.