[PATCH] mm/mempolicy: return NULL if node is NUMA_NO_NODE in get_task_policy

From: Jianguo Wu
Date: Tue Aug 06 2013 - 00:07:36 EST


If node == NUMA_NO_NODE, pol is NULL, we should return NULL instead of
do "if (!pol->mode)" check.

Signed-off-by: Jianguo Wu <wujianguo@xxxxxxxxxx>
---
mm/mempolicy.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 4baf12e..e0e3398 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -129,6 +129,8 @@ static struct mempolicy *get_task_policy(struct task_struct *p)
node = numa_node_id();
if (node != NUMA_NO_NODE)
pol = &preferred_node_policy[node];
+ else
+ return NULL;

/* preferred_node_policy is not initialised early in boot */
if (!pol->mode)
--
1.8.2.2



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/