summaryrefslogtreecommitdiff
path: root/lib/string.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2022-12-12 21:47:03 +0300
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2022-12-12 21:47:03 +0300
commite291c116f60f3c1ca98090f0f8e7c77e658562fb (patch)
tree2fbe810f2a6f8b29f1cdaefd87b24debbfa0ec07 /lib/string.c
parent8c9a59939deb4bfafdc451100c03d1e848b4169b (diff)
parentc3991107a28a5ad0bd90660ca3bbf8c2c220ea98 (diff)
downloadlinux-e291c116f60f3c1ca98090f0f8e7c77e658562fb.tar.xz
Merge branch 'next' into for-linus
Prepare input updates for 6.2 merge window.
Diffstat (limited to 'lib/string.c')
-rw-r--r--lib/string.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/string.c b/lib/string.c
index 6f334420f687..3371d26a0e39 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -197,6 +197,14 @@ ssize_t strscpy(char *dest, const char *src, size_t count)
max = 0;
#endif
+ /*
+ * read_word_at_a_time() below may read uninitialized bytes after the
+ * trailing zero and use them in comparisons. Disable this optimization
+ * under KMSAN to prevent false positive reports.
+ */
+ if (IS_ENABLED(CONFIG_KMSAN))
+ max = 0;
+
while (max >= sizeof(unsigned long)) {
unsigned long c, data;