Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp534021pxb; Wed, 8 Sep 2021 06:50:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvPqPtA9PVOw9hhk8VDZEXZIhYlSXV1uj10gyQb+NmHfvWvkWWDh5q6Znp1zsManjtgcIZ X-Received: by 2002:a6b:e90c:: with SMTP id u12mr3261258iof.95.1631109031376; Wed, 08 Sep 2021 06:50:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631109031; cv=none; d=google.com; s=arc-20160816; b=Jq+YVjLggkx/MO7EbtquAaO9Kz7D8WVWzJdC0C4T/GmTyMC//ZyXzxgeJF+T1iIbKM OjJWKQNHktLabTyeri4FRZcnol+vtk2xn9Hc4bhzu5DzriVQq7I83srslbvw/KxlCtS8 T4As5NI8g3BUL3XagyENnrC1KqsC+m7+9w8hw09aF1NwpLmYXnTn35gwyJyyvi8gLUVv c+HNjXf2x1YCG/EnfTcHcrbeVDwSSOq/PXXASfUJPPbR9Ytlg2KHT6cPS1zWesWZKJwX xS1QXX4Y6toybialXaDpk8yiB+H20cBPh0RvtcPnB7nV6H4GquAof4v/HO14czZ3g8DG SmdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=A1n4ILCtM1X2Y8ay+C8F+KpSsPy2PuvE7HCormzCao0=; b=QqvSZx22OIuJijr67pSCuLmP3tdUbXrfMhP7M7qIa6o6bmW8VaMFpImWQnFInwyYHs Udbz0/IUmdk9GvuLKTryQere+mzUPxRGiDRNBqW8xtZ84vnmQIamJjFJpwFOArYfnIML stukWdIYkvCoJnM5SK2IqzCLDuKjL0tq5bRET53/wu6tTkgR+YH05QC+KEq0p0HxZKI5 /R6iU3vo/nuNGoGienY9qnKZt+OLZAGv8JbU8utSdyw6M6S/acXfDbeJfV9Ltqo+oE4U h2crtNtC50/Pa1RGCVlZRpp3xIllOMQawmotHuYpJiE5kmU7qtojX6x9+Sxer5KBmboN Qm/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Vxb6+Mtp; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e35si1984394jaa.106.2021.09.08.06.50.15; Wed, 08 Sep 2021 06:50:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Vxb6+Mtp; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351482AbhIHNbe (ORCPT + 99 others); Wed, 8 Sep 2021 09:31:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351727AbhIHNao (ORCPT ); Wed, 8 Sep 2021 09:30:44 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF129C061757 for ; Wed, 8 Sep 2021 06:29:35 -0700 (PDT) Message-ID: <20210908132525.794334915@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1631107774; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=A1n4ILCtM1X2Y8ay+C8F+KpSsPy2PuvE7HCormzCao0=; b=Vxb6+MtpZI9k1XCQdVFMVlSfDHIOsvCuLHKVNO8FiuC6FyNZYxVPcCOBT+6fJM+U+UvIgp YPtJQVLtkbzZMBfoA1ItlXl9p/IH+bWlC9E0WkKuhPo3jGMSVRlDwnPEWrLntI5RORiYv6 nNvXZM3QkAjjFeze2wRYOPqIYMMwUUkdP2fnlPrz6xEo0Hsm8z747xF2dlgYVn1869Ks5O 0nOZYL2J/zqLXDXFPstgn4JuvjSG8INiQJ2CYxX9zko+0FMSSegNEQb4lgwqPfpWcB4RrK RfyCm8PsiT4HpONlSsRqF0qjMhfQMdLzaDTnX8cZJS+e/awpnvdvKNqlpylWig== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1631107774; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=A1n4ILCtM1X2Y8ay+C8F+KpSsPy2PuvE7HCormzCao0=; b=MIr1hv7aSoKy3ycmqfFe9BZM5OQ9BF+MrMX05Nppl6GAu8VyC5B/g7xaRss++uIHKjW9eY bs+Fh9bhDDzukCCQ== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Al Viro , Linus Torvalds , Tony Luck , Alexei Starovoitov , Peter Ziljstra , Song Liu , Daniel Borkmann Subject: [patch V3 15/20] x86/fpu/signal: Change return type of copy_fpregs_to_sigframe() helpers to boolean References: <20210908130922.118265849@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Wed, 8 Sep 2021 15:29:34 +0200 (CEST) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that copy_fpregs_to_sigframe() returns boolean the individual return codes in the related helper functions do not make sense anymore. Change them to return boolean success/fail. Signed-off-by: Thomas Gleixner --- arch/x86/kernel/fpu/signal.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) --- a/arch/x86/kernel/fpu/signal.c +++ b/arch/x86/kernel/fpu/signal.c @@ -65,7 +65,7 @@ static inline int check_xstate_in_sigfra /* * Signal frame handlers. */ -static inline int save_fsave_header(struct task_struct *tsk, void __user *buf) +static inline bool save_fsave_header(struct task_struct *tsk, void __user *buf) { if (use_fxsr()) { struct xregs_state *xsave = &tsk->thread.fpu.state.xsave; @@ -82,18 +82,19 @@ static inline int save_fsave_header(stru if (__copy_to_user(buf, &env, sizeof(env)) || __put_user(xsave->i387.swd, &fp->status) || __put_user(X86_FXSR_MAGIC, &fp->magic)) - return -1; + return false; } else { struct fregs_state __user *fp = buf; u32 swd; + if (__get_user(swd, &fp->swd) || __put_user(swd, &fp->status)) - return -1; + return false; } - return 0; + return true; } -static inline int save_xstate_epilog(void __user *buf, int ia32_frame) +static inline bool save_xstate_epilog(void __user *buf, int ia32_frame) { struct xregs_state __user *x = buf; struct _fpx_sw_bytes *sw_bytes; @@ -131,7 +132,7 @@ static inline int save_xstate_epilog(voi err |= __put_user(xfeatures, (__u32 __user *)&x->header.xfeatures); - return err; + return !err; } static inline int copy_fpregs_to_sigframe(struct xregs_state __user *buf) @@ -219,10 +220,10 @@ bool copy_fpstate_to_sigframe(void __use } /* Save the fsave header for the 32-bit frames. */ - if ((ia32_fxstate || !use_fxsr()) && save_fsave_header(tsk, buf)) + if ((ia32_fxstate || !use_fxsr()) && !save_fsave_header(tsk, buf)) return false; - if (use_fxsr() && save_xstate_epilog(buf_fx, ia32_fxstate)) + if (use_fxsr() && !save_xstate_epilog(buf_fx, ia32_fxstate)) return false; return true;