X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=arch%2Fx86_64%2Fmm%2Ffault.c;h=2f187986f940b6e6bfe8f6a475b6658571d2cabe;hb=76381fee7e8feb4c22be636aa5d4765dbe4fbf9e;hp=57d3ab15a5c737aeda66c83ed6756cae3c9924e5;hpb=e9129e56e9ec50c0689eb4cf7a3ca132f1e776db;p=~andy%2Flinux diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c index 57d3ab15a5c..2f187986f94 100644 --- a/arch/x86_64/mm/fault.c +++ b/arch/x86_64/mm/fault.c @@ -74,7 +74,7 @@ static noinline int is_prefetch(struct pt_regs *regs, unsigned long addr, instr = (unsigned char *)convert_rip_to_linear(current, regs); max_instr = instr + 15; - if ((regs->cs & 3) != 0 && instr >= (unsigned char *)TASK_SIZE) + if (user_mode(regs) && instr >= (unsigned char *)TASK_SIZE) return 0; while (scan_more && instr < max_instr) { @@ -106,7 +106,7 @@ static noinline int is_prefetch(struct pt_regs *regs, unsigned long addr, /* Could check the LDT for lm, but for now it's good enough to assume that long mode only uses well known segments or kernel. */ - scan_more = ((regs->cs & 3) == 0) || (regs->cs == __USER_CS); + scan_more = (!user_mode(regs)) || (regs->cs == __USER_CS); break; case 0x60: