From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030248AbdIZIcP (ORCPT ); Tue, 26 Sep 2017 04:32:15 -0400 Received: from terminus.zytor.com ([65.50.211.136]:56409 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751689AbdIZIcN (ORCPT ); Tue, 26 Sep 2017 04:32:13 -0400 Date: Tue, 26 Sep 2017 01:25:27 -0700 From: tip-bot for Ingo Molnar Message-ID: Cc: torvalds@linux-foundation.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, peterz@infradead.org, luto@amacapital.net, dave.hansen@linux.intel.com, yu-cheng.yu@intel.com, riel@redhat.com, fenghua.yu@intel.com, luto@kernel.org, oleg@redhat.com, akpm@linux-foundation.org, ebiggers3@gmail.com, hpa@zytor.com, mingo@kernel.org, bp@alien8.de Reply-To: akpm@linux-foundation.org, oleg@redhat.com, luto@kernel.org, mingo@kernel.org, bp@alien8.de, hpa@zytor.com, ebiggers3@gmail.com, riel@redhat.com, fenghua.yu@intel.com, yu-cheng.yu@intel.com, dave.hansen@linux.intel.com, torvalds@linux-foundation.org, luto@amacapital.net, peterz@infradead.org, linux-kernel@vger.kernel.org, tglx@linutronix.de In-Reply-To: <20170923130016.21448-11-mingo@kernel.org> References: <20170923130016.21448-11-mingo@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/fpu] x86/fpu: Simplify __copy_xstate_to_kernel() return values Git-Commit-ID: 8c0817f4a3188ac5485ce14f96f12a175800b881 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 8c0817f4a3188ac5485ce14f96f12a175800b881 Gitweb: http://git.kernel.org/tip/8c0817f4a3188ac5485ce14f96f12a175800b881 Author: Ingo Molnar AuthorDate: Sat, 23 Sep 2017 14:59:53 +0200 Committer: Ingo Molnar CommitDate: Sun, 24 Sep 2017 13:04:32 +0200 x86/fpu: Simplify __copy_xstate_to_kernel() return values __copy_xstate_to_kernel() can only return 0 (because kernel copies cannot fail), simplify the code throughout. No change in functionality. Cc: Andrew Morton Cc: Andy Lutomirski Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Dave Hansen Cc: Eric Biggers Cc: Fenghua Yu Cc: Linus Torvalds Cc: Oleg Nesterov Cc: Peter Zijlstra Cc: Rik van Riel Cc: Thomas Gleixner Cc: Yu-cheng Yu Link: http://lkml.kernel.org/r/20170923130016.21448-11-mingo@kernel.org Signed-off-by: Ingo Molnar --- 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 b18c545..00c3b41 100644 --- a/arch/x86/kernel/fpu/xstate.c +++ b/arch/x86/kernel/fpu/xstate.c @@ -924,7 +924,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) { @@ -933,7 +933,6 @@ __copy_xstate_to_kernel(void *kbuf, const void *data, memcpy(kbuf + offset, data, copy); } - return 0; } /* @@ -946,8 +945,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: @@ -968,9 +967,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++) { /* @@ -986,9 +983,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); } } @@ -999,9 +994,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; }