summaryrefslogtreecommitdiffstats
path: root/kernel/kcsan/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/kcsan/test.c')
-rw-r--r--kernel/kcsan/test.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/kcsan/test.c b/kernel/kcsan/test.c
index cc6000239dc0..d26a052d3383 100644
--- a/kernel/kcsan/test.c
+++ b/kernel/kcsan/test.c
@@ -92,6 +92,16 @@ static bool test_matching_access(void)
return false;
if (WARN_ON(matching_access(9, 1, 10, 1)))
return false;
+
+ /*
+ * An access of size 0 could match another access, as demonstrated here.
+ * Rather than add more comparisons to 'matching_access()', which would
+ * end up in the fast-path for *all* checks, check_access() simply
+ * returns for all accesses of size 0.
+ */
+ if (WARN_ON(!matching_access(8, 8, 12, 0)))
+ return false;
+
return true;
}