Re: [patch 2.6.13-rc4] fix get_user_pages bug

Alexander Nyberg
2005-08-04T14:15:21Z

On Wed, Aug 03, 2005 at 09:12:37AM -0700 Linus Torvalds wrote:

>
>
> On Wed, 3 Aug 2005, Nick Piggin wrote:
> >
> > Oh, it gets rid of the -1 for VM_FAULT_OOM. Doesn't seem like there
> > is a good reason for it, but might that break out of tree drivers?
>
> Ok, I applied this because it was reasonably pretty and I liked the
> approach. It seems buggy, though, since it was using "switch ()" to test
> the bits (wrongly, afaik), and I'm going to apply the appended on top of
> it. Holler quickly if you disagreee..
>

x86_64 had hardcoded the VM_ numbers so it broke down when the numbers
were changed.

Signed-off-by: Alexander Nyberg <alexn@telia.com>

Index: linux-2.6/arch/x86_64/mm/fault.c
===================================================================
--- linux-2.6.orig/arch/x86_64/mm/fault.c 2005-07-31 18:10:20.000000000 +0200
+++ linux-2.6/arch/x86_64/mm/fault.c 2005-08-04 16:04:59.000000000 +0200
@@ -439,13 +439,13 @@
* the fault.
*/
switch (handle_mm_fault(mm, vma, address, write)) {
- case 1:
+ case VM_FAULT_MINOR:
tsk->min_flt++;
break;
- case 2:
+ case VM_FAULT_MAJOR:
tsk->maj_flt++;
break;
- case 0:
+ case VM_FAULT_SIGBUS:
goto do_sigbus;
default:
goto out_of_memory;