[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <519F3592.4090207@huawei.com>
Date: Fri, 24 May 2013 17:40:34 +0800
From: Libo Chen <clbchenlibo.chen@...wei.com>
To: <megaraidlinux@....com>, <JBottomley@...allels.com>
CC: <linux-scsi@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>,
<kashyap.desai@....com>, <aradford@...il.com>,
Li Zefan <lizefan@...wei.com>, Santosh Y <santoshsy@...il.com>
Subject: [PATCH RESEND] scsi: megaraid: check kzalloc
we should check kzalloc, avoid to hit oops
Signed-off-by: Libo Chen <libo.chen@...wei.com>
---
drivers/scsi/megaraid.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
instead of checking scmd->device, sdev is more appropriate.
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 846f475..6b623cb 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -4161,6 +4161,10 @@ mega_internal_command(adapter_t *adapter, megacmd_t *mc, mega_passthru *pthru)
memset(scb, 0, sizeof(scb_t));
sdev = kzalloc(sizeof(struct scsi_device), GFP_KERNEL);
+ if (sdev) {
+ scsi_free_command(GFP_KERNEL, scmd);
+ return -ENOMEM;
+ }
scmd->device = sdev;
memset(adapter->int_cdb, 0, sizeof(adapter->int_cdb));
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists