From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx127.postini.com [74.125.245.127]) by kanga.kvack.org (Postfix) with SMTP id B9C896B0031 for ; Tue, 6 Aug 2013 00:07:30 -0400 (EDT) Message-ID: <52007660.7070907@huawei.com> Date: Tue, 6 Aug 2013 12:06:56 +0800 From: Jianguo Wu MIME-Version: 1.0 Subject: [PATCH] mm/mempolicy: return NULL if node is NUMA_NO_NODE in get_task_policy Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Mel Gorman , Andrew Morton Cc: KOSAKI Motohiro , Rik van Riel , Hugh Dickins , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Hanjun Guo If node == NUMA_NO_NODE, pol is NULL, we should return NULL instead of do "if (!pol->mode)" check. Signed-off-by: Jianguo Wu --- 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, 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: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751093Ab3HFEH3 (ORCPT ); Tue, 6 Aug 2013 00:07:29 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:35327 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750794Ab3HFEH2 (ORCPT ); Tue, 6 Aug 2013 00:07:28 -0400 Message-ID: <52007660.7070907@huawei.com> Date: Tue, 6 Aug 2013 12:06:56 +0800 From: Jianguo Wu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Mel Gorman , Andrew Morton CC: KOSAKI Motohiro , Rik van Riel , Hugh Dickins , , , Hanjun Guo Subject: [PATCH] mm/mempolicy: return NULL if node is NUMA_NO_NODE in get_task_policy Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.135.74.216] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If node == NUMA_NO_NODE, pol is NULL, we should return NULL instead of do "if (!pol->mode)" check. Signed-off-by: Jianguo Wu --- 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