Re: [PATCH] lib/string: Fix UBSAN misaligned access in sized_strscpy
From: Andy Shevchenko
Date: Tue Feb 24 2026 - 12:22:51 EST
On Tue, Feb 24, 2026 at 05:04:27PM +0000, Fuad Tabba wrote:
> sized_strscpy() performs word-at-a-time writes to the destination
> buffer. If the destination buffer is not aligned to unsigned long,
> direct assignment causes UBSAN misaligned-access errors.
>
> Use put_unaligned() to safely write the words to the destination.
Have you measured the performance impact?
Have you read the comment near to
if (IS_ENABLED(CONFIG_KMSAN))
?
--
With Best Regards,
Andy Shevchenko