Skip to content

Commit b351018

Browse files
andreas-schwabpalmer-dabbelt
authored andcommitted
riscv: traps_misaligned: properly sign extend value in misaligned load handler
Add missing cast to signed long. Signed-off-by: Andreas Schwab <[email protected]> Fixes: 956d705 ("riscv: Unaligned load/store handling for M_MODE") Tested-by: Clément Léger <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 969f028 commit b351018

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/riscv/kernel/traps_misaligned.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ static int handle_scalar_misaligned_load(struct pt_regs *regs)
461461
}
462462

463463
if (!fp)
464-
SET_RD(insn, regs, val.data_ulong << shift >> shift);
464+
SET_RD(insn, regs, (long)(val.data_ulong << shift) >> shift);
465465
else if (len == 8)
466466
set_f64_rd(insn, regs, val.data_u64);
467467
else

0 commit comments

Comments
 (0)