]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
riscv: process: use unsigned int instead of unsigned long for put_user()
authorClément Léger <cleger@rivosinc.com>
Mon, 2 Jun 2025 19:39:15 +0000 (21:39 +0200)
committerPalmer Dabbelt <palmer@dabbelt.com>
Thu, 5 Jun 2025 18:39:16 +0000 (11:39 -0700)
The specification of prctl() for GET_UNALIGN_CTL states that the value is
returned in an unsigned int * address passed as an unsigned long. Change
the type to match that and avoid an unaligned access as well.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/20250602193918.868962-3-cleger@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
arch/riscv/kernel/process.c

index 7c244de7718008947075357ea4502d56419d507c..fe10e326f44eee0c5330158fa447c78ddfaba430 100644 (file)
@@ -57,7 +57,7 @@ int get_unalign_ctl(struct task_struct *tsk, unsigned long adr)
        if (!unaligned_ctl_available())
                return -EINVAL;
 
-       return put_user(tsk->thread.align_ctl, (unsigned long __user *)adr);
+       return put_user(tsk->thread.align_ctl, (unsigned int __user *)adr);
 }
 
 void __show_regs(struct pt_regs *regs)