Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kernel: fix off-by-one benign bugs

We were wasting a byte due to an off-by-one bug. s[c]nprintf() doesn't
write more than $2 bytes including the null byte, so trying to pass
'size-1' there is wasting one byte.

This is essentially the same as the previous commit, in a different
file.

Link: https://lkml.kernel.org/r/b4a945a4d40b7104364244f616eb9fb9f1fa691f.1765449750.git.alx@kernel.org
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Cc: Marco Elver <elver@google.com>
Cc: Kees Cook <kees@kernel.org>
Cc: Christopher Bazley <chris.bazley.wg14@gmail.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Jann Horn <jannh@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Marco Elver <elver@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Maciej W. Rozycki <macro@orcam.me.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Alejandro Colomar and committed by
Andrew Morton
a9e5620c 8118f197

+2 -2
+2 -2
kernel/kcsan/kcsan_test.c
··· 176 176 177 177 /* Title */ 178 178 cur = expect[0]; 179 - end = &expect[0][sizeof(expect[0]) - 1]; 179 + end = ARRAY_END(expect[0]); 180 180 cur += scnprintf(cur, end - cur, "BUG: KCSAN: %s in ", 181 181 is_assert ? "assert: race" : "data-race"); 182 182 if (r->access[1].fn) { ··· 200 200 201 201 /* Access 1 */ 202 202 cur = expect[1]; 203 - end = &expect[1][sizeof(expect[1]) - 1]; 203 + end = ARRAY_END(expect[1]); 204 204 if (!r->access[1].fn) 205 205 cur += scnprintf(cur, end - cur, "race at unknown origin, with "); 206 206