summaryrefslogtreecommitdiff
path: root/arch/i386/mm
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2006-12-07 01:14:06 (GMT)
committerAndi Kleen <andi@basil.nowhere.org>2006-12-07 01:14:06 (GMT)
commit11a4180c0b03e2ee0c948fd8430ee092dc1625b3 (patch)
treec0f5018983f859d84b0832ea793ba0c49d344935 /arch/i386/mm
parentab2bf0c1c689905b628dca94d0acd9c50e152468 (diff)
downloadlinux-fsl-qoriq-11a4180c0b03e2ee0c948fd8430ee092dc1625b3.tar.xz
[PATCH] i386: Use probe_kernel_address instead of __get_user in fault paths
Makes the intention of the code cleaner to read and avoids a potential deadlock on mmap_sem. Also change the types of the arguments to not include __user because they're really not user addresses. Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'arch/i386/mm')
-rw-r--r--arch/i386/mm/fault.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c
index 2581575..aaaa4d2 100644
--- a/arch/i386/mm/fault.c
+++ b/arch/i386/mm/fault.c
@@ -22,9 +22,9 @@
#include <linux/highmem.h>
#include <linux/module.h>
#include <linux/kprobes.h>
+#include <linux/uaccess.h>
#include <asm/system.h>
-#include <asm/uaccess.h>
#include <asm/desc.h>
#include <asm/kdebug.h>
#include <asm/segment.h>
@@ -167,7 +167,7 @@ static inline unsigned long get_segment_eip(struct pt_regs *regs,
static int __is_prefetch(struct pt_regs *regs, unsigned long addr)
{
unsigned long limit;
- unsigned long instr = get_segment_eip (regs, &limit);
+ unsigned char *instr = (unsigned char *)get_segment_eip (regs, &limit);
int scan_more = 1;
int prefetch = 0;
int i;
@@ -177,9 +177,9 @@ static int __is_prefetch(struct pt_regs *regs, unsigned long addr)
unsigned char instr_hi;
unsigned char instr_lo;
- if (instr > limit)
+ if (instr > (unsigned char *)limit)
break;
- if (__get_user(opcode, (unsigned char __user *) instr))
+ if (probe_kernel_address(instr, opcode))
break;
instr_hi = opcode & 0xf0;
@@ -204,9 +204,9 @@ static int __is_prefetch(struct pt_regs *regs, unsigned long addr)
case 0x00:
/* Prefetch instruction is 0x0F0D or 0x0F18 */
scan_more = 0;
- if (instr > limit)
+ if (instr > (unsigned char *)limit)
break;
- if (__get_user(opcode, (unsigned char __user *) instr))
+ if (probe_kernel_address(instr, opcode))
break;
prefetch = (instr_lo == 0xF) &&
(opcode == 0x0D || opcode == 0x18);