Disable the efficient 8-byte reading under KMSAN to avoid false positives.
Showing the changes to lib/string.c (1 of 1 file). Show all
Unified · Split
| @@ -197,6 +197,14 @@ ssize_t strscpy(char *dest, const char *src, size_t count) · 196 unmodified lines | |||
| 197 | max = 0; | 197 | max = 0; |
| 198 | #endif | 198 | #endif |
| 199 | 199 | ||
| 200 | /* | ||
| 201 | * read_word_at_a_time() below may read uninitialized bytes after the | ||
| 202 | * trailing zero and use them in comparisons. Disable this optimization | ||
| 203 | * under KMSAN to prevent false positive reports. | ||
| 204 | */ | ||
| 205 | if (IS_ENABLED(CONFIG_KMSAN)) | ||
| 206 | max = 0; | ||
| 207 | |||
| 200 | while (max >= sizeof(unsigned long)) { | 208 | while (max >= sizeof(unsigned long)) { |
| 201 | unsigned long c, data; | 209 | unsigned long c, data; |
| 202 | 210 | ||