Received: by 10.192.165.148 with SMTP id m20csp1084852imm; Sat, 21 Apr 2018 00:32:39 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/1pNOsdpZUMkQC+TcpHG820Yj8CoUd1QXfcP+Ni3GNgCbjfS6a/5y+46QjUH3qH+tSTUIc X-Received: by 10.99.116.76 with SMTP id e12mr10653855pgn.270.1524295959548; Sat, 21 Apr 2018 00:32:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524295959; cv=none; d=google.com; s=arc-20160816; b=lxeoCxoMRuAuA77TJTjy8YYWe8r9b3IR9IYBGFxZ9Q3lecn8s9mGx3axgVS3xkBaar Iub+rm0gajSVDiC5Yx0UH74znTYLegf4hnKgnCe7O2yemNXUHvL+JcvbYVbgKIKcAVzV 0gHXQqOn9bZCcJ/eGddZ2ARQmXAmKi2xNgwRsOgM02CRe+HyzGhMlYD+TPqX2dms7Ren j20LvtTtUJcO7BWwHHGMz+nuXxPBqjJsSDEmjLEm832vKTYTM4aKB0YEDcqbxfQfxt4z 9RMpqy+On71Kk6+w7zMTKk4+i7WH8ANlG5EYjSuRdZXcKP6ZpER2rUyVSXrPEOT4eWs8 yb+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=UFMt71tvb8qDdirtnBOoOwtUDtdXvfhwIZAY3i+sLx0=; b=qSUFj7miCI/IlCIIG1g8DYocjaxxfh8mXT6jhbwOyiK1av60x74/3yuy3twqfvAKS+ fEl31mPhF8YXyZ5zgk6+5tmmvataA/2S1DtB0V8PVLcXrZug36WOwXT3eVmwIbqpDY4T ml9UKWYZ838Y5nwGAVmzfzwOcVq8Xzrs5lMA0LY7XNdImXfWr/tSIBoMXCmtUUuluhVB 8Qbs3uSG47/3c6Ov6EmktfSvj+6UxazL2eCPwsvlS+HDa5KIfW7/i51zEtIviUJTByZK WKSLVwd9xLzSDxgNkm33bxbZnjMfyWvnGLotJY4kSM8ey53dPaUfDhk2+9sILuBhEYYo FxuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=KcISa7X4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h67si2411762pfk.15.2018.04.21.00.32.00; Sat, 21 Apr 2018 00:32:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=KcISa7X4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752478AbeDUHZx (ORCPT + 99 others); Sat, 21 Apr 2018 03:25:53 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:36912 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750931AbeDUHZv (ORCPT ); Sat, 21 Apr 2018 03:25:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=UFMt71tvb8qDdirtnBOoOwtUDtdXvfhwIZAY3i+sLx0=; b=KcISa7X41ZOsKc5XAb1p0vHk4 mm3DUClueJ+/kYAlhJGj4lnOCXzaogmdtnDi7qSLWigiXdmnnGsAJV8qMJzlkHjU4gTKQfQcDtYNs 9r9aa8ykbedhT6aJ2tJ6KkksRsPy6gTeFdADfM3kSLb9f1fKRSlGKKGbCnjNJSQx4mwnjCCcxUgoB PaZjSAgs2tI47pLNVLu6EDWeHDHOokABw4WnOlteLentxssYkCp3wKxUlw7pcIfLstXewOjm5BEm0 62O+Y/KO9PnCLZVmdAzaXNL3rOip3BxIUgHpTIRI4vdPSfZM3VFNbYM/k9+82jebyltzyqt0YlX6F Eg/ksjN6w==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9mu6-0003FP-Pc; Sat, 21 Apr 2018 07:25:50 +0000 Date: Sat, 21 Apr 2018 00:25:50 -0700 From: Christoph Hellwig To: "Eric W. Biederman" Cc: linux-arch@vger.kernel.org, linux-riscv@lists.infradead.org, Palmer Dabbelt , linux-kernel@vger.kernel.org, Albert Ou Subject: Re: [REVIEW][PATCH 14/22] signal/riscv: Use force_sig_fault where appropriate Message-ID: <20180421072550.GA6973@infradead.org> References: <87604mhrnb.fsf@xmission.com> <20180420143811.9994-14-ebiederm@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180420143811.9994-14-ebiederm@xmission.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 20, 2018 at 09:38:03AM -0500, Eric W. Biederman wrote: > Filling in struct siginfo before calling force_sig_info a tedious and > error prone process, where once in a great while the wrong fields > are filled out, and siginfo has been inconsistently cleared. > > Simplify this process by using the helper force_sig_fault. Which > takes as a parameters all of the information it needs, ensures > all of the fiddly bits of filling in struct siginfo are done properly > and then calls force_sig_info. > > In short about a 5 line reduction in code for every time force_sig_info > is called, which makes the calling function clearer. > > Cc: Palmer Dabbelt > Cc: Albert Ou > Cc: linux-riscv@lists.infradead.org > Signed-off-by: "Eric W. Biederman" > --- > arch/riscv/kernel/traps.c | 9 +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) > > diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c > index 48aa6471cede..3087940008f4 100644 > --- a/arch/riscv/kernel/traps.c > +++ b/arch/riscv/kernel/traps.c > @@ -66,14 +66,7 @@ void die(struct pt_regs *regs, const char *str) > static inline void do_trap_siginfo(int signo, int code, > unsigned long addr, struct task_struct *tsk) > { > - siginfo_t info; > - > - clear_siginfo(&info); > - info.si_signo = signo; > - info.si_errno = 0; > - info.si_code = code; > - info.si_addr = (void __user *)addr; > - force_sig_info(signo, &info, tsk); > + force_sig_fault(signo, code, (void __user *)addr, tsk); > } Please kill the do_trap_siginfo helper and use force_sig_fault directly in both callers.