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>
This commit is contained in:
Benjamin Berg 2024-10-31 15:20:16 +01:00 committed by Johannes Berg
parent 0b0ad2541d
commit 32f1fde0b6
2 changed files with 9 additions and 6 deletions

View 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

View 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;
}