Skip to content

Commit 22b5f16

Browse files
mcd500palmer-dabbelt
authored andcommitted
riscv: __asm_copy_to-from_user: Fix: fail on RV32
Had a bug when converting bytes to bits when the cpu was rv32. The a3 contains the number of bytes and multiple of 8 would be the bits. The LGREG is holding 2 for RV32 and 3 for RV32, so to achieve multiple of 8 it must always be constant 3. The 2 was mistakenly used for rv32. Signed-off-by: Akira Tsukamoto <[email protected]> Fixes: ca6eaaa ("riscv: __asm_copy_to-from_user: Optimize unaligned memory access and pipeline stall") Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 6010d30 commit 22b5f16

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/riscv/lib/uaccess.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ ENTRY(__asm_copy_from_user)
125125
* t3 - prev shift
126126
* t4 - current shift
127127
*/
128-
slli t3, a3, LGREG
128+
slli t3, a3, 3 /* converting bytes in a3 to bits */
129129
li a5, SZREG*8
130130
sub t4, a5, t3
131131

0 commit comments

Comments
 (0)