diff options
| author | Takashi Iwai <tiwai@suse.de> | 2025-05-16 10:58:27 +0300 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2025-05-16 10:58:35 +0300 |
| commit | a3d14d1602ca11429d242d230c31af8f822f614f (patch) | |
| tree | cb15a4235841e657753505538e6715711e7cd151 /lib/string.c | |
| parent | 1c116e5569ef3bd33be1d6f687b0270c0932838d (diff) | |
| parent | 7b9938a14460e8ec7649ca2e80ac0aae9815bf02 (diff) | |
| download | linux-a3d14d1602ca11429d242d230c31af8f822f614f.tar.xz | |
Merge branch 'for-linus' into for-next
Back-merge of 6.15 devel branch for further development of HD-audio
stuff.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'lib/string.c')
| -rw-r--r-- | lib/string.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/string.c b/lib/string.c index eb4486ed40d2..b632c71df1a5 100644 --- a/lib/string.c +++ b/lib/string.c @@ -119,6 +119,7 @@ ssize_t sized_strscpy(char *dest, const char *src, size_t count) if (count == 0 || WARN_ON_ONCE(count > INT_MAX)) return -E2BIG; +#ifndef CONFIG_DCACHE_WORD_ACCESS #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS /* * If src is unaligned, don't cross a page boundary, @@ -134,11 +135,13 @@ ssize_t sized_strscpy(char *dest, const char *src, size_t count) if (((long) dest | (long) src) & (sizeof(long) - 1)) max = 0; #endif +#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. + * load_unaligned_zeropad() or 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; @@ -146,7 +149,11 @@ ssize_t sized_strscpy(char *dest, const char *src, size_t count) while (max >= sizeof(unsigned long)) { unsigned long c, data; +#ifdef CONFIG_DCACHE_WORD_ACCESS + c = load_unaligned_zeropad(src+res); +#else c = read_word_at_a_time(src+res); +#endif if (has_zero(c, &data, &constants)) { data = prep_zero_mask(c, data, &constants); data = create_zero_mask(data); |
