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 <charlie@rivosinc.com> Reviewed-by: Samuel Holland <samuel.holland@sifive.com> Tested-by: Samuel Holland <samuel.holland@sifive.com> Tested-by: Björn Töpel <bjorn@rivosinc.com> Link: https://lore.kernel.org/r/20231127-module_linking_freeing-v4-2-a2ca1d7027d0@rivosinc.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent d8792a5 commit 4a92a87

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

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)