diff options
author | Benjamin Berg <benjamin.berg@intel.com> | 2024-10-31 15:20:16 +0100 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2024-11-07 17:34:50 +0100 |
commit | 32f1fde0b631b36417356f7896d5bc18c44886d3 (patch) | |
tree | 66c50997507fb2a23dd74bd7ef1ce1c1c283f190 /arch/x86 | |
parent | um: Remove double zero check (diff) | |
download | linux-32f1fde0b631b36417356f7896d5bc18c44886d3.tar.xz linux-32f1fde0b631b36417356f7896d5bc18c44886d3.zip |
um: fix sparse warnings from regset refactor
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>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/um/ptrace.c | 2 | ||||
-rw-r--r-- | arch/x86/um/signal.c | 13 |
2 files changed, 9 insertions, 6 deletions
diff --git a/arch/x86/um/ptrace.c b/arch/x86/um/ptrace.c index 54d924bc45ce..57c504fd5626 100644 --- a/arch/x86/um/ptrace.c +++ b/arch/x86/um/ptrace.c @@ -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 diff --git a/arch/x86/um/signal.c b/arch/x86/um/signal.c index 94b2b2bbae31..797c4e4e57f3 100644 --- a/arch/x86/um/signal.c +++ b/arch/x86/um/signal.c @@ -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; } |