Received: by 10.192.165.148 with SMTP id m20csp344565imm; Fri, 20 Apr 2018 07:42:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx482+ueO8AGJRQF/pTuTKk0jhwqPxYYo0HlJNlqrSzAhPq2Fxclax2qOfg5OZftQ8sT+skNL X-Received: by 10.99.95.76 with SMTP id t73mr8824989pgb.226.1524235333724; Fri, 20 Apr 2018 07:42:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524235333; cv=none; d=google.com; s=arc-20160816; b=QzF8TquH0+7/FjLm6IkKMYsWEZqWouDIx5Fgd+SwuDpyICGoklzaaJdcMYFrUgoESe 6bLRbgLSp5Zw6xjGOdUaVX28nzkrN+pslfq6GwdYqZQzdsWsCFUKJMZjbxuXGdCH1MKt RkXlm/26krR5XKDXTFMpV3CMuLi2joTwLY9qjDxHZtptkrqvdG6vS38QP8S7Kgihy7fN +DJ1qcxbdeSpKHiHWEJhq98GPc6v0IWpq24KszKwgsjPa/rtI3G/CaFuWfrTewSBkOSj 5UOj2l4rHoRWddb53kzzNtaM5CliolS0YBApjWE5kSTVG0AAUxLWXdLi38dEJm6HOEt2 +s9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=t1mUfnc1xHh0E5ZlebIUxd/A5+ZZYhAWI7uhRo+q93k=; b=Au8WmbV654MRAy4V1mSUyF5Uvifmi+cDmk7cPLdo1uCJtrlUt/H3jNoYm7TLsn6Rlg 3Lk9/JuNXNrWsWKxb8iJ0Aeh2yT95vyXT/M2R1SFFilFEAb3FECN661BHbkGkZ20rcmC EECvhmrB8lnL8Je/Hx4oCCRO7hgLhBSYHY2jxn+TCSxSmqLpdxJ4Ckb/Drgx9QYq4qd0 B+AN+NLhWuyJ7hXpeSzi52gMiX1NzI2bmID0KbpDGFTgS8LJUlsKtxAzYr5EYKHvKHNB cDKKuaqlMLvBBtCAGuHc6I1Q5j7GNXh88iKH4nJuIkYpgUjFB/vb2A2BvcgMlvidoa1S 4lNg== ARC-Authentication-Results: i=1; mx.google.com; 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 r4si4846013pgt.7.2018.04.20.07.41.59; Fri, 20 Apr 2018 07:42:13 -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; 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 S1755438AbeDTOku (ORCPT + 99 others); Fri, 20 Apr 2018 10:40:50 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:44253 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755160AbeDTOkp (ORCPT ); Fri, 20 Apr 2018 10:40:45 -0400 Received: from in02.mta.xmission.com ([166.70.13.52]) by out02.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1f9XDR-0007WX-1g; Fri, 20 Apr 2018 08:40:45 -0600 Received: from [97.119.174.25] (helo=x220.int.ebiederm.org) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1f9XDQ-0006Ha-1j; Fri, 20 Apr 2018 08:40:44 -0600 From: "Eric W. Biederman" To: linux-arch@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "Eric W. Biederman" , Michal Simek Date: Fri, 20 Apr 2018 09:37:56 -0500 Message-Id: <20180420143811.9994-7-ebiederm@xmission.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <87604mhrnb.fsf@xmission.com> References: <87604mhrnb.fsf@xmission.com> X-XM-SPF: eid=1f9XDQ-0006Ha-1j;;;mid=<20180420143811.9994-7-ebiederm@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=97.119.174.25;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1/CeKj8uKU97zAH3M6UK1hNg5q8AZPldsI= X-SA-Exim-Connect-IP: 97.119.174.25 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on sa02.xmission.com X-Spam-Level: *** X-Spam-Status: No, score=3.6 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TR_Symld_Words,T_TM2_M_HEADER_IN_MSG,T_TooManySym_01, XMNoVowels,XMSolicitRefs_0,XMSubLong autolearn=disabled version=3.4.0 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 1.5 TR_Symld_Words too many words that have symbols inside * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa02 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 0.1 XMSolicitRefs_0 Weightloss drug X-Spam-DCC: XMission; sa02 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ***;linux-arch@vger.kernel.org X-Spam-Relay-Country: X-Spam-Timing: total 638 ms - load_scoreonly_sql: 0.08 (0.0%), signal_user_changed: 3.1 (0.5%), b_tie_ro: 2.1 (0.3%), parse: 1.21 (0.2%), extract_message_metadata: 30 (4.7%), get_uri_detail_list: 3.0 (0.5%), tests_pri_-1000: 12 (1.9%), tests_pri_-950: 2.1 (0.3%), tests_pri_-900: 1.72 (0.3%), tests_pri_-400: 31 (4.8%), check_bayes: 29 (4.5%), b_tokenize: 11 (1.7%), b_tok_get_all: 7 (1.1%), b_comp_prob: 3.3 (0.5%), b_tok_touch_all: 2.4 (0.4%), b_finish: 1.16 (0.2%), tests_pri_0: 430 (67.5%), check_dkim_signature: 0.82 (0.1%), check_dkim_adsp: 4.6 (0.7%), tests_pri_500: 120 (18.8%), poll_dns_idle: 109 (17.0%), rewrite_mail: 0.00 (0.0%) Subject: [REVIEW][PATCH 07/22] signal/microblaze: Use force_sig_fault where appropriate X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: Michal Simek Signed-off-by: "Eric W. Biederman" --- arch/microblaze/kernel/exceptions.c | 9 +-------- arch/microblaze/mm/fault.c | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/arch/microblaze/kernel/exceptions.c b/arch/microblaze/kernel/exceptions.c index 443ec1feacb4..eafff21fcb0e 100644 --- a/arch/microblaze/kernel/exceptions.c +++ b/arch/microblaze/kernel/exceptions.c @@ -60,17 +60,10 @@ asmlinkage void sw_exception(struct pt_regs *regs) void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr) { - siginfo_t info; - if (kernel_mode(regs)) die("Exception in kernel mode", regs, signr); - clear_siginfo(&info); - info.si_signo = signr; - info.si_errno = 0; - info.si_code = code; - info.si_addr = (void __user *) addr; - force_sig_info(signr, &info, current); + force_sig_fault(signr, code, (void __user *)addr, current); } asmlinkage void full_exception(struct pt_regs *regs, unsigned int type, diff --git a/arch/microblaze/mm/fault.c b/arch/microblaze/mm/fault.c index 1251d380df47..af607447c683 100644 --- a/arch/microblaze/mm/fault.c +++ b/arch/microblaze/mm/fault.c @@ -289,14 +289,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long address, do_sigbus: up_read(&mm->mmap_sem); if (user_mode(regs)) { - siginfo_t info; - - clear_siginfo(&info); - info.si_signo = SIGBUS; - info.si_errno = 0; - info.si_code = BUS_ADRERR; - info.si_addr = (void __user *)address; - force_sig_info(SIGBUS, &info, current); + force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, current); return; } bad_page_fault(regs, address, SIGBUS); -- 2.14.1