From: Nicholas Mc Guire <hofrat@osadl.org>
To: Mike Marciniszyn <infinipath@intel.com>
Cc: Doug Ledford <dledford@redhat.com>,
Sean Hefty <sean.hefty@intel.com>,
Hal Rosenstock <hal.rosenstock@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-rdma@vger.kernel.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org,
Nicholas Mc Guire <hofrat@osadl.org>
Subject: [PATCH 2/3] staging/rdma/hfi1: check return value of kcalloc
Date: Mon, 14 Dec 2015 15:43:08 +0100 [thread overview]
Message-ID: <1450104189-2653-2-git-send-email-hofrat@osadl.org> (raw)
In-Reply-To: <1450104189-2653-1-git-send-email-hofrat@osadl.org>
Add a null check after the kcalloc call as proposed by
Mike Marciniszyn <mike.marciniszyn@intel.com>.
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---
Patch was compile tested with: x86_64_defconfig
CONFIG_INFINIBAND=m, CONFIG_STAGING=y, CONFIG_STAGING_RDMA=m
Patch is against linux-next (localversion-next is -next-20151214)
drivers/staging/rdma/hfi1/chip.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c
index 31eec8a..52d2bd7 100644
--- a/drivers/staging/rdma/hfi1/chip.c
+++ b/drivers/staging/rdma/hfi1/chip.c
@@ -10129,6 +10129,9 @@ static void init_qos(struct hfi1_devdata *dd, u32 first_ctxt)
if (num_vls * qpns_per_vl > dd->chip_rcv_contexts)
goto bail;
rsmmap = kcalloc(NUM_MAP_REGS, sizeof(u64), GFP_KERNEL);
+ if (!rsmmap)
+ goto bail;
+
/* init the local copy of the table */
for (i = 0, ctxt = first_ctxt; i < num_vls; i++) {
unsigned tctxt;
--
1.7.10.4
next prev parent reply other threads:[~2015-12-14 14:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-14 14:43 [PATCH 1/3] staging/rdma/hfi1: consolidate kmalloc_array+memset into kcalloc Nicholas Mc Guire
2015-12-14 14:43 ` Nicholas Mc Guire [this message]
2015-12-14 15:21 ` [PATCH 2/3] staging/rdma/hfi1: check return value of kcalloc Marciniszyn, Mike
2015-12-14 17:36 ` Nicholas Mc Guire
2015-12-14 14:43 ` [PATCH 3/3] staging/rdma/hfi1: fix build warning Nicholas Mc Guire
2015-12-14 15:28 ` [PATCH 1/3] staging/rdma/hfi1: consolidate kmalloc_array+memset into kcalloc Marciniszyn, Mike
2015-12-14 17:41 ` Nicholas Mc Guire
2015-12-14 18:09 ` Dan Carpenter
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=1450104189-2653-2-git-send-email-hofrat@osadl.org \
--to=hofrat@osadl.org \
--cc=devel@driverdev.osuosl.org \
--cc=dledford@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=hal.rosenstock@gmail.com \
--cc=infinipath@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sean.hefty@intel.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
all inboxes | Powered by JetHome®