public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] sched/numa: checking for NULL instead of IS_ERR()
@ 2012-05-22 14:52 Dan Carpenter
  2012-05-23 15:37 ` [tip:sched/numa] sched/numa: Checking " tip-bot for Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-05-22 14:52 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Ingo Molnar, linux-kernel, kernel-janitors

If mpol_new() is called with MPOL_BIND then it can't return a NULL
pointer.  We should be checking IS_ERR() here.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/kernel/sched/numa.c b/kernel/sched/numa.c
index 1149993..36d27ac 100644
--- a/kernel/sched/numa.c
+++ b/kernel/sched/numa.c
@@ -1481,9 +1481,9 @@ SYSCALL_DEFINE4(numa_mbind, unsigned long, addr, unsigned long, len,
 
 	mask = nodemask_of_node(ng->numa_entity.node);
 	mpol = mpol_new(MPOL_BIND, 0, &mask);
-	if (!mpol) {
+	if (IS_ERR(mpol)) {
 		ng_put(ng);
-		return -ENOMEM;
+		return PTR_ERR(mpol);
 	}
 	mpol->flags |= MPOL_MF_LAZY;
 	mpol->numa_group = ng;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip:sched/numa] sched/numa: Checking for NULL instead of IS_ERR()
  2012-05-22 14:52 [patch] sched/numa: checking for NULL instead of IS_ERR() Dan Carpenter
@ 2012-05-23 15:37 ` tip-bot for Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Dan Carpenter @ 2012-05-23 15:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, tglx, dan.carpenter

Commit-ID:  63f82f66a208efe0f5f10ed5d0cd8d32c8dfd013
Gitweb:     http://git.kernel.org/tip/63f82f66a208efe0f5f10ed5d0cd8d32c8dfd013
Author:     Dan Carpenter <dan.carpenter@oracle.com>
AuthorDate: Tue, 22 May 2012 17:52:34 +0300
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 23 May 2012 17:11:31 +0200

sched/numa: Checking for NULL instead of IS_ERR()

If mpol_new() is called with MPOL_BIND then it can't return a
NULL pointer.  We should be checking IS_ERR() here.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20120522145233.GA17419@elgon.mountain
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/numa.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/numa.c b/kernel/sched/numa.c
index de66256..25be2b1 100644
--- a/kernel/sched/numa.c
+++ b/kernel/sched/numa.c
@@ -1482,9 +1482,9 @@ SYSCALL_DEFINE4(numa_mbind, unsigned long, addr, unsigned long, len,
 
 	mask = nodemask_of_node(ng->numa_entity.node);
 	mpol = mpol_new(MPOL_BIND, 0, &mask);
-	if (!mpol) {
+	if (IS_ERR(mpol)) {
 		ng_put(ng);
-		return -ENOMEM;
+		return PTR_ERR(mpol);
 	}
 	mpol->flags |= MPOL_MF_LAZY;
 	mpol->numa_group = ng;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-05-23 15:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-22 14:52 [patch] sched/numa: checking for NULL instead of IS_ERR() Dan Carpenter
2012-05-23 15:37 ` [tip:sched/numa] sched/numa: Checking " tip-bot for Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox