From: wenxiong@linux.vnet.ibm.com
To: James.Bottomley@HansenPartnership.com
Cc: linux-scsi@vger.kernel.org, klebers@linux.vnet.ibm.com,
brking@linux.vnet.ibm.com
Subject: [PATCH 2/7] ipr: Handler ID memory allocation failure
Date: Mon, 26 Nov 2012 09:55:36 -0600 [thread overview]
Message-ID: <20121126155632.125112047@linux.vnet.ibm.com> (raw)
In-Reply-To: 20121126155534.352187900@linux.vnet.ibm.com
[-- Attachment #1: fix_mem_alloc_fail --]
[-- Type: text/plain, Size: 1143 bytes --]
Add code to handle memory allocation failures at module load time.
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
---
drivers/scsi/ipr.c | 7 +++++++
1 file changed, 7 insertions(+)
Index: b/drivers/scsi/ipr.c
===================================================================
--- a/drivers/scsi/ipr.c 2012-11-14 23:07:30.067656109 -0600
+++ b/drivers/scsi/ipr.c 2012-11-14 23:09:49.484214019 -0600
@@ -8516,6 +8516,10 @@ static int __devinit ipr_alloc_mem(struc
BITS_TO_LONGS(ioa_cfg->max_devs_supported), GFP_KERNEL);
ioa_cfg->vset_ids = kzalloc(sizeof(unsigned long) *
BITS_TO_LONGS(ioa_cfg->max_devs_supported), GFP_KERNEL);
+
+ if (!ioa_cfg->target_ids || !ioa_cfg->array_ids
+ || !ioa_cfg->vset_ids)
+ goto out_free_res_entries;
}
for (i = 0; i < ioa_cfg->max_devs_supported; i++) {
@@ -8591,6 +8595,9 @@ out_free_vpd_cbs:
ioa_cfg->vpd_cbs, ioa_cfg->vpd_cbs_dma);
out_free_res_entries:
kfree(ioa_cfg->res_entries);
+ kfree(ioa_cfg->target_ids);
+ kfree(ioa_cfg->array_ids);
+ kfree(ioa_cfg->vset_ids);
goto out;
}
--
next prev parent reply other threads:[~2012-11-26 16:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-26 15:55 [PATCH 0/7] Add support for new IBM SAS controllers wenxiong
2012-11-26 15:55 ` [PATCH 1/7] ipr: Add sereral new CCIN definitions for new adapters support wenxiong
2012-11-26 15:55 ` wenxiong [this message]
2012-11-30 15:30 ` [PATCH 2/7] ipr: Handler ID memory allocation failure James Bottomley
2012-12-03 21:25 ` wenxiong
2012-11-26 15:55 ` [PATCH 3/7] ipr: Resource path error logging cleanup wenxiong
2012-11-26 15:55 ` [PATCH 4/7] ipr: Add support for MSI-X and distributed completion wenxiong
2012-11-26 15:55 ` [PATCH 5/7] ipr: Reduce lock contention wenxiong
2012-11-26 15:55 ` [PATCH 6/7] ipr: Implement block iopoll wenxiong
2012-12-17 10:16 ` James Bottomley
2012-11-26 15:55 ` [PATCH 7/7] ipr: Driver version 2.6.0 wenxiong
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=20121126155632.125112047@linux.vnet.ibm.com \
--to=wenxiong@linux.vnet.ibm.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=brking@linux.vnet.ibm.com \
--cc=klebers@linux.vnet.ibm.com \
--cc=linux-scsi@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).