Skip to content

Commit 32f1fde

Browse files
benzeajmberg-intel
authored andcommitted
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 <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Fixes: 3f17fed ("um: switch to regset API and depend on XSTATE") Signed-off-by: Benjamin Berg <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent 0b0ad25 commit 32f1fde

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

arch/x86/um/ptrace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ static struct user_regset uml_regsets[] __ro_after_init = {
242242
/* TODO: Add TLS regset for 32bit */
243243
};
244244

245-
const struct user_regset_view user_uml_view = {
245+
static const struct user_regset_view user_uml_view = {
246246
#ifdef CONFIG_X86_32
247247
.name = "i386", .e_machine = EM_386,
248248
#else

arch/x86/um/signal.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ static int copy_sc_from_user(struct pt_regs *regs,
8282
#undef GETREG
8383

8484
#ifdef CONFIG_X86_32
85-
from_fp64 = ((void *)sc.fpstate) + offsetof(struct _fpstate_32, _fxsr_env);
85+
from_fp64 = ((void __user *)sc.fpstate) +
86+
offsetof(struct _fpstate_32, _fxsr_env);
8687
#else
87-
from_fp64 = (void *)sc.fpstate;
88+
from_fp64 = (void __user *)sc.fpstate;
8889
#endif
8990

9091
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,
9798
task_user_regset_view(current),
9899
REGSET_FP_LEGACY, 0,
99100
sizeof(struct user_i387_struct),
100-
(void *)sc.fpstate);
101+
(void __user *)sc.fpstate);
101102
if (err < 0)
102103
return err;
103104
#endif
@@ -173,7 +174,8 @@ static int copy_sc_to_user(struct sigcontext __user *to,
173174
BUILD_BUG_ON(offsetof(struct _xstate, xstate_hdr) !=
174175
offsetof(struct _xstate_64, xstate_hdr) +
175176
offsetof(struct _fpstate_32, _fxsr_env));
176-
to_fp64 = (void *)to_fp + offsetof(struct _fpstate_32, _fxsr_env);
177+
to_fp64 = (void __user *)to_fp +
178+
offsetof(struct _fpstate_32, _fxsr_env);
177179
#else
178180
to_fp64 = to_fp;
179181
#endif /* CONFIG_X86_32 */
@@ -198,7 +200,8 @@ static int copy_sc_to_user(struct sigcontext __user *to,
198200
__put_user(host_fp_size, &to_fp64->fpstate.sw_reserved.xstate_size);
199201

200202
__put_user(FP_XSTATE_MAGIC1, &to_fp64->fpstate.sw_reserved.magic1);
201-
__put_user(FP_XSTATE_MAGIC2, (int *)((void *)to_fp64 + host_fp_size));
203+
__put_user(FP_XSTATE_MAGIC2,
204+
(int __user *)((void __user *)to_fp64 + host_fp_size));
202205

203206
return 0;
204207
}

0 commit comments

Comments
 (0)