Skip to content

Commit 4a92a87

Browse files
charlie-rivospalmer-dabbelt
authored andcommitted
riscv: Correct type casting in module loading
Use __le16 with le16_to_cpu. Fixes: 8fd6c51 ("riscv: Add remaining module relocations") Signed-off-by: Charlie Jenkins <[email protected]> Reviewed-by: Samuel Holland <[email protected]> Tested-by: Samuel Holland <[email protected]> Tested-by: Björn Töpel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent d8792a5 commit 4a92a87

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/riscv/kernel/module.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static bool riscv_insn_valid_32bit_offset(ptrdiff_t val)
5555

5656
static int riscv_insn_rmw(void *location, u32 keep, u32 set)
5757
{
58-
u16 *parcel = location;
58+
__le16 *parcel = location;
5959
u32 insn = (u32)le16_to_cpu(parcel[0]) | (u32)le16_to_cpu(parcel[1]) << 16;
6060

6161
insn &= keep;
@@ -68,7 +68,7 @@ static int riscv_insn_rmw(void *location, u32 keep, u32 set)
6868

6969
static int riscv_insn_rvc_rmw(void *location, u16 keep, u16 set)
7070
{
71-
u16 *parcel = location;
71+
__le16 *parcel = location;
7272
u16 insn = le16_to_cpu(*parcel);
7373

7474
insn &= keep;

0 commit comments

Comments
 (0)