public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: WANG Cong <xiyou.wangcong@gmail.com>
To: rolandd@cisco.com, mshefty@ichips.intel.com, halr@voltaire.com
Cc: Andrew Morton <akpm@osdl.org>, LKML <linux-kernel@vger.kernel.org>
Subject: [-mm Patch] INFINIBAND: check the return value of kmalloc
Date: Thu, 5 Jul 2007 00:37:41 +0800	[thread overview]
Message-ID: <20070704163741.GA2510@localhost.localdomain> (raw)


Don't forget to check the return value of kmalloc().

Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>

---

Index: linux-2.6.22-rc6-mm1/drivers/infiniband/hw/cxgb3/iwch_provider.c
===================================================================
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c	2007-06-29 13:18:20.000000000 +0800
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c	2007-07-04 23:17:02.000000000 +0800
@@ -1166,6 +1166,10 @@
 	dev->ibdev.iwcm =
 	    (struct iw_cm_verbs *) kmalloc(sizeof(struct iw_cm_verbs),
 					   GFP_KERNEL);
+	if (!dev->ibdev.iwcm) {
+		ret = -1;
+		goto bail1;
+	}
 	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-04 16:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-04 16:37 WANG Cong [this message]
2007-07-05  0:00 ` [-mm Patch] INFINIBAND: check the return value of kmalloc Jesper Juhl
2007-07-05 21:42   ` Roland Dreier
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=20070704163741.GA2510@localhost.localdomain \
    --to=xiyou.wangcong@gmail.com \
    --cc=akpm@osdl.org \
    --cc=halr@voltaire.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mshefty@ichips.intel.com \
    --cc=rolandd@cisco.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox