Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1567282
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 10/14] x86/fpu: Simplify __copy_xstate_to_kernel() return values |
| Date | 2017-01-26 11:30 +0100 |
| Message-ID | <t3Ptw-68L-11@gated-at.bofh.it> (permalink) |
| References | <t3Ptv-68L-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
__copy_xstate_to_kernel() can only return 0 (because kernel copies cannot fail),
simplify the code throughout.
No change in functionality.
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/kernel/fpu/xstate.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
index cceabca485c8..7d24fe305d4b 100644
--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -923,7 +923,7 @@ int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,
* This is similar to user_regset_copyout(), but will not add offset to
* the source data pointer or increment pos, count, kbuf, and ubuf.
*/
-static inline int
+static inline void
__copy_xstate_to_kernel(void *kbuf, const void *data,
unsigned int offset, unsigned int size, unsigned int size_total)
{
@@ -932,7 +932,6 @@ __copy_xstate_to_kernel(void *kbuf, const void *data,
memcpy(kbuf + offset, data, copy);
}
- return 0;
}
/*
@@ -945,8 +944,8 @@ __copy_xstate_to_kernel(void *kbuf, const void *data,
int copy_xstate_to_kernel(void *kbuf, struct xregs_state *xsave, unsigned int offset_start, unsigned int size_total)
{
unsigned int offset, size;
- int ret, i;
struct xstate_header header;
+ int i;
/*
* Currently copy_regset_to_user() starts from pos 0:
@@ -967,9 +966,7 @@ int copy_xstate_to_kernel(void *kbuf, struct xregs_state *xsave, unsigned int of
offset = offsetof(struct xregs_state, header);
size = sizeof(header);
- ret = __copy_xstate_to_kernel(kbuf, &header, offset, size, size_total);
- if (ret)
- return ret;
+ __copy_xstate_to_kernel(kbuf, &header, offset, size, size_total);
for (i = 0; i < XFEATURE_MAX; i++) {
/*
@@ -985,9 +982,7 @@ int copy_xstate_to_kernel(void *kbuf, struct xregs_state *xsave, unsigned int of
if (offset + size > size_total)
break;
- ret = __copy_xstate_to_kernel(kbuf, src, offset, size, size_total);
- if (ret)
- return ret;
+ __copy_xstate_to_kernel(kbuf, src, offset, size, size_total);
}
}
@@ -998,9 +993,7 @@ int copy_xstate_to_kernel(void *kbuf, struct xregs_state *xsave, unsigned int of
offset = offsetof(struct fxregs_state, sw_reserved);
size = sizeof(xstate_fx_sw_bytes);
- ret = __copy_xstate_to_kernel(kbuf, xstate_fx_sw_bytes, offset, size, size_total);
- if (ret)
- return ret;
+ __copy_xstate_to_kernel(kbuf, xstate_fx_sw_bytes, offset, size, size_total);
return 0;
}
--
2.7.4
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 10/14] x86/fpu: Simplify __copy_xstate_to_kernel() return values Ingo Molnar <mingo@kernel.org> - 2017-01-26 11:30 +0100
csiph-web