From: zhouxinxing <xinxing2zhou@gmail.com>
To: Mauro Dreissig <mukadr@gmail.com>, linux-mm@kvack.org
Subject: Re: [PATCH] mm: numa: fix NULL pointer dereference
Date: Wed, 07 Aug 2013 08:19:22 +0800 [thread overview]
Message-ID: <395f1269-2a31-44be-90ff-d2c470d64ca7@email.android.com> (raw)
In-Reply-To: <20130807000154.GA3507@z460>
[-- Attachment #1: Type: text/plain, Size: 1345 bytes --]
Is it possible to check pol if it is equal to NULL prior to access to mode field?
Mauro Dreissig <mukadr@gmail.com> wrote:
>From: Mauro Dreissig <mukadr@gmail.com>
>
>The "pol->mode" field is accessed even when no mempolicy
>is assigned to the "pol" variable.
>
>Signed-off-by: Mauro Dreissig <mukadr@gmail.com>
>---
> mm/mempolicy.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
>diff --git a/mm/mempolicy.c b/mm/mempolicy.c
>index 6b1d426..105fff0 100644
>--- a/mm/mempolicy.c
>+++ b/mm/mempolicy.c
>@@ -127,12 +127,16 @@ static struct mempolicy *get_task_policy(struct
>task_struct *p)
>
> if (!pol) {
> node = numa_node_id();
>- if (node != NUMA_NO_NODE)
>+ if (node != NUMA_NO_NODE) {
> pol = &preferred_node_policy[node];
>
>- /* preferred_node_policy is not initialised early in boot */
>- if (!pol->mode)
>- pol = NULL;
>+ /*
>+ * preferred_node_policy is not initialised early
>+ * in boot
>+ */
>+ if (!pol->mode)
>+ pol = NULL;
>+ }
> }
>
> return pol;
>--
>1.8.1.2
>
>--
>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>
--
Sent from my Android device with Gmail Plus. Please excuse my brevity.
[-- Attachment #2: Type: text/html, Size: 1616 bytes --]
next prev parent reply other threads:[~2013-08-07 0:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-07 0:02 Mauro Dreissig
2013-08-07 0:19 ` zhouxinxing [this message]
2013-08-07 2:10 ` Mauro Dreissig
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=395f1269-2a31-44be-90ff-d2c470d64ca7@email.android.com \
--to=xinxing2zhou@gmail.com \
--cc=linux-mm@kvack.org \
--cc=mukadr@gmail.com \
/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