Skip to contentSkip to conversation

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

PATCH In review Dan Carpenter 1 participant 2 messages May 22, 2012 – May 23, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

kernel/sched/numa.c +2 -2
index 1149993..36d27ac 100644
@@ -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;
#1 lore raw

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

Commit-ID:  63f82f66a208efe0f5f10ed5d0cd8d32c8dfd013
Gitweb:     http://git.kernel.org/tip/63f82f66a208efe0f5f10ed5d0cd8d32c8dfd013
Author:     Dan Carpenter <[email protected]>
AuthorDate: Tue, 22 May 2012 17:52:34 +0300
Committer:  Ingo Molnar <[email protected]>
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.

---
 kernel/sched/numa.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/sched/numa.c +2 -2
index de66256..25be2b1 100644
@@ -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;