linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: linux-nfs@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] NFS: kmalloc() doesn't return an ERR_PTR()
Date: Mon, 14 May 2012 22:45:28 +0300	[thread overview]
Message-ID: <20120514194528.GA19613@elgon.mountain> (raw)

Obviously we should check for NULL here instead of IS_ERR().

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

diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index ba3019f..233beea 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -644,14 +644,14 @@ static int nfs_idmap_legacy_upcall(struct key_construction *cons,
 
 	/* msg and im are freed in idmap_pipe_destroy_msg */
 	msg = kmalloc(sizeof(*msg), GFP_KERNEL);
-	if (IS_ERR(msg)) {
-		ret = PTR_ERR(msg);
+	if (!msg) {
+		ret = -ENOMEM;
 		goto out0;
 	}
 
 	im = kmalloc(sizeof(*im), GFP_KERNEL);
-	if (IS_ERR(im)) {
-		ret = PTR_ERR(im);
+	if (!im) {
+		ret = -ENOMEM;
 		goto out1;
 	}
 

             reply	other threads:[~2012-05-14 19:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-14 19:45 Dan Carpenter [this message]
2012-05-15 13:48 ` [patch] NFS: kmalloc() doesn't return an ERR_PTR() Boaz Harrosh
2012-05-15 13:57   ` Dan Carpenter
2012-05-15 14:18     ` Boaz Harrosh
2012-05-15 15:27       ` Jim Rees
2012-05-15 16:06         ` Boaz Harrosh
2012-05-15 16:49       ` walter harms
2012-05-16  0:38         ` Peng Tao

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=20120514194528.GA19613@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).