[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080131235544.346b938a.akpm@linux-foundation.org>
Date: Thu, 31 Jan 2008 23:55:44 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: "Kenichi Okuyama" <kenichi.okuyama@...il.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [patch] NULL pointer check for vma->vm_mm
On Fri, 1 Feb 2008 16:39:07 +0900 "Kenichi Okuyama" <kenichi.okuyama@...il.com> wrote:
> 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
If we dereference NULL then the kernel will display basically the same
information as would a BUG, and it takes the same action. So adding a
BUG_ON here really doesn't gain us anything.
Also, I think vma->vm_mm == 0 is not a valid state, so this just shouldn't
happen - the code is OK to assume that a particular invariant is being
honoured.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists