int copy_xstate_to_kernel(void *kbuf, struct xregs_state *xsave, unsigned int offset, unsigned int size);
int copy_xstate_to_user(void __user *ubuf, struct xregs_state *xsave, unsigned int offset, unsigned int size);
int copy_kernel_to_xstate(const void *kbuf, struct xregs_state *xsave);
-int copy_user_to_xstate(const void *kbuf, const void __user *ubuf, struct xregs_state *xsave);
+int copy_user_to_xstate(const void __user *ubuf, struct xregs_state *xsave);
#endif
if (kbuf)
ret = copy_kernel_to_xstate(kbuf, xsave);
else
- ret = copy_user_to_xstate(kbuf, ubuf, xsave);
+ ret = copy_user_to_xstate(ubuf, xsave);
} else {
ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, xsave, 0, -1);
}
*/
fpu__drop(fpu);
- if (using_compacted_format()) {
- err = copy_user_to_xstate(NULL, buf_fx,
- &fpu->state.xsave);
- } else {
- err = __copy_from_user(&fpu->state.xsave,
- buf_fx, state_size);
- }
+ if (using_compacted_format())
+ err = copy_user_to_xstate(buf_fx, &fpu->state.xsave);
+ else
+ err = __copy_from_user(&fpu->state.xsave, buf_fx, state_size);
if (err || __copy_from_user(&env, buf, sizeof(env))) {
fpstate_init(&fpu->state);
* there we check the CPU has XSAVES and a whole standard-sized buffer
* exists.
*/
-int copy_user_to_xstate(const void *kbuf, const void __user *ubuf,
- struct xregs_state *xsave)
+int copy_user_to_xstate(const void __user *ubuf, struct xregs_state *xsave)
{
unsigned int offset, size;
int i;
offset = offsetof(struct xregs_state, header);
size = sizeof(xfeatures);
- if (kbuf) {
- memcpy(&xfeatures, kbuf + offset, size);
- } else {
- if (__copy_from_user(&xfeatures, ubuf + offset, size))
- return -EFAULT;
- }
+ if (__copy_from_user(&xfeatures, ubuf + offset, size))
+ return -EFAULT;
/*
* Reject if the user sets any disabled or supervisor features:
offset = xstate_offsets[i];
size = xstate_sizes[i];
- if (kbuf) {
- memcpy(dst, kbuf + offset, size);
- } else {
- if (__copy_from_user(dst, ubuf + offset, size))
- return -EFAULT;
- }
+ if (__copy_from_user(dst, ubuf + offset, size))
+ return -EFAULT;
}
}