All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <rdreier@cisco.com>
To: "Jesper Juhl" <jesper.juhl@gmail.com>
Cc: "WANG Cong" <xiyou.wangcong@gmail.com>,
	rolandd@cisco.com, mshefty@ichips.intel.com, halr@voltaire.com,
	"Andrew Morton" <akpm@osdl.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Steve Wise <swise@opengridcomputing.com>
Subject: Re: [-mm Patch] INFINIBAND: check the return value of kmalloc
Date: Thu, 05 Jul 2007 14:42:37 -0700	[thread overview]
Message-ID: <ada1wfm4jea.fsf@cisco.com> (raw)
In-Reply-To: <9a8748490707041700q18608e3ave4465f1181b97e2f@mail.gmail.com> (Jesper Juhl's message of "Thu, 5 Jul 2007 02:00:07 +0200")

thanks, I added Jesper's suggestion to the original patch and queued
this for 2.6.23:

(Steve, let me know if this looks OK or not to you)

commit 8d339921a2cb279457dce79f8a308978e0b41b27
Author: WANG Cong <xiyou.wangcong@gmail.com>
Date:   Thu Jul 5 14:40:32 2007 -0700

    RDMA/cxgb3: Check return of kmalloc() in iwch_register_device()
    
    Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
    [ Also remove cast from void * return of kmalloc() as suggested by
      Jesper Juhl <jesper.juhl@gmail.com>. ]
    Signed-off-by: Roland Dreier <rolandd@cisco.com>

diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index e7c2c39..44b6ad2 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -1163,9 +1163,10 @@ int iwch_register_device(struct iwch_dev *dev)
 	dev->ibdev.post_recv = iwch_post_receive;
 
 
-	dev->ibdev.iwcm =
-	    (struct iw_cm_verbs *) kmalloc(sizeof(struct iw_cm_verbs),
-					   GFP_KERNEL);
+	dev->ibdev.iwcm = kmalloc(sizeof(struct iw_cm_verbs), GFP_KERNEL);
+	if (!dev->ibdev.icwm)
+		return -ENOMEM;
+
 	dev->ibdev.iwcm->connect = iwch_connect;
 	dev->ibdev.iwcm->accept = iwch_accept_cr;
 	dev->ibdev.iwcm->reject = iwch_reject_cr;

  reply	other threads:[~2007-07-05 21:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-04 16:37 [-mm Patch] INFINIBAND: check the return value of kmalloc WANG Cong
2007-07-05  0:00 ` Jesper Juhl
2007-07-05 21:42   ` Roland Dreier [this message]
2007-07-05 22:26     ` Jesper Juhl
2007-07-06  3:03     ` WANG Cong
2007-07-09 19:57     ` Steve Wise

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=ada1wfm4jea.fsf@cisco.com \
    --to=rdreier@cisco.com \
    --cc=akpm@osdl.org \
    --cc=halr@voltaire.com \
    --cc=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mshefty@ichips.intel.com \
    --cc=rolandd@cisco.com \
    --cc=swise@opengridcomputing.com \
    --cc=xiyou.wangcong@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.