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

From: Dan Carpenter
Date: Tue May 22 2012 - 10:52:46 EST


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@xxxxxxxxxx>

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;
--
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/