]> git.baikalelectronics.ru Git - kernel.git/commit
riscv: __asm_copy_to-from_user: Fix: overrun copy
authorAkira Tsukamoto <akira.tsukamoto@gmail.com>
Tue, 20 Jul 2021 08:50:52 +0000 (17:50 +0900)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Sat, 24 Jul 2021 00:48:52 +0000 (17:48 -0700)
commit2a0103b311534f46695089b34f964825cf8b3781
treecb9a13e091564601e86ccc04f4e5424a1399cb27
parent5fae9d84cdc7ce8791ac3a7d439e1aec1416fe8a
riscv: __asm_copy_to-from_user: Fix: overrun copy

There were two causes for the overrun memory access.

The threshold size was too small.
The aligning dst require one SZREG and unrolling word copy requires
8*SZREG, total have to be at least 9*SZREG.

Inside the unrolling copy, the subtracting -(8*SZREG-1) would make
iteration happening one extra loop. Proper value is -(8*SZREG).

Signed-off-by: Akira Tsukamoto <akira.tsukamoto@gmail.com>
Fixes: 014115b0f2e3 ("riscv: __asm_copy_to-from_user: Optimize unaligned memory access and pipeline stall")
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/lib/uaccess.S