Skip to contentSkip to conversation

Check find_vma return code in make_pages_present()

PATCH New Dave Jones 1 participant 1 message Sep 1, 2004

Subsystems (2)
lore
Share & tools
lore

Dave Jones

author
#0 lore raw

PATCH 1/1 Check find_vma return code in make_pages_present()

It can return NULL, so check for it.

Spotted with the source checker from Coverity.com.

mm/memory.c +2 -0
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/mm/memory.c linux-2.6/mm/memory.c
@@ -1744,6 +1744,8 @@ int make_pages_present(unsigned long add
 	struct vm_area_struct * vma;
 
 	vma = find_vma(current->mm, addr);
+	if (!vma)
+		return -1;
 	write = (vma->vm_flags & VM_WRITE) != 0;
 	if (addr >= end)
 		BUG();