kcsan: selftest: Ensure that address is at least PAGE_SIZE
authorMarco Elver <elver@google.com>
Thu, 22 Oct 2020 11:45:52 +0000 (13:45 +0200)
committerPaul E. McKenney <paulmck@kernel.org>
Tue, 3 Nov 2020 01:08:50 +0000 (17:08 -0800)
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>
kernel/kcsan/selftest.c

index d98bc20..9014a3a 100644 (file)
@@ -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;