From: Andrew Morton <akpm@linux-foundation.org>
To: Kenichi Okuyama <kenichi.okuyama@gmail.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [patch] NULL pointer check for vma->vm_mm
Date: Thu, 31 Jan 2008 23:55:44 -0800 [thread overview]
Message-ID: <20080131235544.346b938a.akpm@linux-foundation.org> (raw)
In-Reply-To: <3fd7d7a70801312339p2a142096p83ed286c81379728@mail.gmail.com>
On Fri, 1 Feb 2008 16:39:07 +0900 "Kenichi Okuyama" <kenichi.okuyama@gmail.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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-02-01 7:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-01 7:39 [patch] NULL pointer check for vma->vm_mm Kenichi Okuyama
2008-02-01 7:55 ` Andrew Morton [this message]
2008-02-01 8:24 ` Kenichi Okuyama
2008-02-01 10:19 ` Andrew Morton
2008-02-01 17:39 ` Kenichi Okuyama
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080131235544.346b938a.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=kenichi.okuyama@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).