LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [patch] NULL pointer check for vma->vm_mm
@ 2008-02-01  7:39 Kenichi Okuyama
  2008-02-01  7:55 ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Kenichi Okuyama @ 2008-02-01  7:39 UTC (permalink / raw)
  To: linux-mm, linux-kernel, akpm

[-- Attachment #1: Type: text/plain, Size: 455 bytes --]

Dear all,

I was looking at the ./mm/rmap.c .. I found that, in function
"page_referenced_one()",
   struct mm_struct *mm = vma->vm_mm;
was being refererred without NULL check.

Though I do agree that this works for most of the cases, I thought it
is better to add
BUG_ON() for case of mm being NULL.

attached is the patch for this

thank you in advance for taking your time.
best regards,
-- 
(Kenichi Okuyama)
URL: http://www.dd.iij4u.or.jp/~okuyamak/

[-- Attachment #2: patch.mm --]
[-- Type: application/octet-stream, Size: 316 bytes --]

--- ./mm/rmap.c.orig	2008-02-01 15:36:50.000000000 +0900
+++ ./mm/rmap.c	2008-02-01 15:42:43.000000000 +0900
@@ -276,6 +276,8 @@ static int page_referenced_one(struct pa
 	spinlock_t *ptl;
 	int referenced = 0;
 
+	BUG_ON(( mm == NULL ));
+
 	address = vma_address(page, vma);
 	if (address == -EFAULT)
 		goto out;

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-02-01 17:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-01  7:39 [patch] NULL pointer check for vma->vm_mm Kenichi Okuyama
2008-02-01  7:55 ` Andrew Morton
2008-02-01  8:24   ` Kenichi Okuyama
2008-02-01 10:19     ` Andrew Morton
2008-02-01 17:39       ` Kenichi Okuyama

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).