Re: [PATCH 1/2] word-at-a-time: check the first byte in load_unaligned_zeropad()

From: Andrey Ryabinin

Date: Tue Oct 20 2026 - 13:01:42 EST


Qiliang Yuan <odys.yuan@xxxxxxxxx> writes:

>
> diff --git a/arch/arm/include/asm/word-at-a-time.h b/arch/arm/include/asm/word-at-a-time.h
> index 5023f98d8293d..f672aad2e30e6 100644
> --- a/arch/arm/include/asm/word-at-a-time.h
> +++ b/arch/arm/include/asm/word-at-a-time.h
> @@ -56,6 +56,9 @@ static inline unsigned long find_zero(unsigned long mask)
> #include <asm-generic/word-at-a-time.h>
> #endif
>
> +#include <linux/kasan-checks.h>
> +#include <linux/kcsan-checks.h>
> +
> #ifdef CONFIG_DCACHE_WORD_ACCESS
>
> /*
> @@ -69,6 +72,10 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)
> {
> unsigned long ret, tmp;
>
> + /* open-coded instrument_read(addr, 1), as in read_word_at_a_time() */

Why it's open-coded ?

> + kasan_check_read(addr, 1);
> + kcsan_check_read(addr, 1);
> +
> /* Load word from unaligned pointer addr */
> asm(
> "1: ldr %0, [%2]\n"