diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2018-04-16 11:26:58 -0500 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2018-04-25 10:41:00 -0500 |
commit | 1a4bd9792dfac587dbec800e2c3e6d17a0b3e6d7 (patch) | |
tree | e1cd5134fcb903de343015b5c1d77908715e1969 /arch/hexagon/mm | |
parent | 559f9008bbc56c2a561cd923709728af0cf659ac (diff) | |
download | linux-stable-1a4bd9792dfac587dbec800e2c3e6d17a0b3e6d7.tar.gz linux-stable-1a4bd9792dfac587dbec800e2c3e6d17a0b3e6d7.tar.bz2 linux-stable-1a4bd9792dfac587dbec800e2c3e6d17a0b3e6d7.zip |
signal/hexagon: Use force_sig_fault as appropriate
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: Richard Kuo <rkuo@codeaurora.org>
Cc: linux-hexagon@vger.kernel.org
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'arch/hexagon/mm')
-rw-r--r-- | arch/hexagon/mm/vm_fault.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/arch/hexagon/mm/vm_fault.c b/arch/hexagon/mm/vm_fault.c index 2ad92edc877c..933bbcef5363 100644 --- a/arch/hexagon/mm/vm_fault.c +++ b/arch/hexagon/mm/vm_fault.c @@ -50,13 +50,12 @@ void do_page_fault(unsigned long address, long cause, struct pt_regs *regs) { struct vm_area_struct *vma; struct mm_struct *mm = current->mm; - siginfo_t info; + int si_signo; int si_code = SEGV_MAPERR; int fault; const struct exception_table_entry *fixup; unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; - clear_siginfo(&info); /* * If we're in an interrupt or have no user context, * then must not take the fault. @@ -141,28 +140,22 @@ good_area: * unable to fix up the page fault. */ if (fault & VM_FAULT_SIGBUS) { - info.si_signo = SIGBUS; - info.si_code = BUS_ADRERR; + si_signo = SIGBUS; + si_code = BUS_ADRERR; } /* Address is not in the memory map */ else { - info.si_signo = SIGSEGV; - info.si_code = SEGV_ACCERR; + si_signo = SIGSEGV; + si_code = SEGV_ACCERR; } - info.si_errno = 0; - info.si_addr = (void __user *)address; - force_sig_info(info.si_signo, &info, current); + force_sig_fault(si_signo, si_code, (void __user *)address, current); return; bad_area: up_read(&mm->mmap_sem); if (user_mode(regs)) { - info.si_signo = SIGSEGV; - info.si_errno = 0; - info.si_code = si_code; - info.si_addr = (void *)address; - force_sig_info(info.si_signo, &info, current); + force_sig_fault(SIGSEGV, si_code, (void __user *)address, current); return; } /* Kernel-mode fault falls through */ |