]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
um: fix sparse warnings from regset refactor
authorBenjamin Berg <benjamin.berg@intel.com>
Thu, 31 Oct 2024 14:20:16 +0000 (15:20 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 7 Nov 2024 16:34:50 +0000 (17:34 +0100)
Some variables were not tagged with __user and another was not marked as
static even though it should be.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202410280655.gOlEFwdG-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202410281821.WSPsAwq7-lkp@intel.com/
Fixes: 3f17fed21491 ("um: switch to regset API and depend on XSTATE")
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Link: https://patch.msgid.link/20241031142017.430420-1-benjamin@sipsolutions.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
arch/x86/um/ptrace.c
arch/x86/um/signal.c

index 54d924bc45cede6b810c95e059bbf00549fbcb27..57c504fd5626e59476c6f918f989e64b648f932a 100644 (file)
@@ -242,7 +242,7 @@ static struct user_regset uml_regsets[] __ro_after_init = {
        /* TODO: Add TLS regset for 32bit */
 };
 
-const struct user_regset_view user_uml_view = {
+static const struct user_regset_view user_uml_view = {
 #ifdef CONFIG_X86_32
        .name = "i386", .e_machine = EM_386,
 #else
index 94b2b2bbae31b6737d514069ba0ac27f82c18bf9..797c4e4e57f3549d996fe0d3cbfcb8ee60c423d6 100644 (file)
@@ -82,9 +82,10 @@ static int copy_sc_from_user(struct pt_regs *regs,
 #undef GETREG
 
 #ifdef CONFIG_X86_32
-       from_fp64 = ((void *)sc.fpstate) + offsetof(struct _fpstate_32, _fxsr_env);
+       from_fp64 = ((void __user *)sc.fpstate) +
+                   offsetof(struct _fpstate_32, _fxsr_env);
 #else
-       from_fp64 = (void *)sc.fpstate;
+       from_fp64 = (void __user *)sc.fpstate;
 #endif
 
        err = copy_from_user(regs->regs.fp, from_fp64, host_fp_size);
@@ -97,7 +98,7 @@ static int copy_sc_from_user(struct pt_regs *regs,
                                    task_user_regset_view(current),
                                    REGSET_FP_LEGACY, 0,
                                    sizeof(struct user_i387_struct),
-                                   (void *)sc.fpstate);
+                                   (void __user *)sc.fpstate);
        if (err < 0)
                return err;
 #endif
@@ -173,7 +174,8 @@ static int copy_sc_to_user(struct sigcontext __user *to,
        BUILD_BUG_ON(offsetof(struct _xstate, xstate_hdr) !=
                     offsetof(struct _xstate_64, xstate_hdr) +
                        offsetof(struct _fpstate_32, _fxsr_env));
-       to_fp64 = (void *)to_fp + offsetof(struct _fpstate_32, _fxsr_env);
+       to_fp64 = (void __user *)to_fp +
+                 offsetof(struct _fpstate_32, _fxsr_env);
 #else
        to_fp64 = to_fp;
 #endif /* CONFIG_X86_32 */
@@ -198,7 +200,8 @@ static int copy_sc_to_user(struct sigcontext __user *to,
        __put_user(host_fp_size, &to_fp64->fpstate.sw_reserved.xstate_size);
 
        __put_user(FP_XSTATE_MAGIC1, &to_fp64->fpstate.sw_reserved.magic1);
-       __put_user(FP_XSTATE_MAGIC2, (int *)((void *)to_fp64 + host_fp_size));
+       __put_user(FP_XSTATE_MAGIC2,
+                  (int __user *)((void __user *)to_fp64 + host_fp_size));
 
        return 0;
 }