public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Dan Carpenter <dan.carpenter@oracle.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	a.p.zijlstra@chello.nl, tglx@linutronix.de,
	dan.carpenter@oracle.com
Subject: [tip:sched/numa] sched/numa: Checking for NULL instead of IS_ERR()
Date: Wed, 23 May 2012 08:37:27 -0700	[thread overview]
Message-ID: <tip-63f82f66a208efe0f5f10ed5d0cd8d32c8dfd013@git.kernel.org> (raw)
In-Reply-To: <20120522145233.GA17419@elgon.mountain>

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;

      reply	other threads:[~2012-05-23 15:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-63f82f66a208efe0f5f10ed5d0cd8d32c8dfd013@git.kernel.org \
    --to=dan.carpenter@oracle.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox