linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: megaraid: check kzalloc
@ 2013-05-24  2:22 Libo Chen
  2013-05-24  3:20 ` Santosh Y
  2013-05-24  9:40 ` [PATCH RESEND] " Libo Chen
  0 siblings, 2 replies; 12+ messages in thread
From: Libo Chen @ 2013-05-24  2:22 UTC (permalink / raw)
  To: megaraidlinux, JBottomley
  Cc: linux-scsi, LKML, kashyap.desai, aradford, Li Zefan


we should check kzalloc, avoid to hit oops

Signed-off-by: Libo Chen <libo.chen@huawei.com>
---
 drivers/scsi/megaraid.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 846f475..195b095 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -4162,6 +4162,10 @@ mega_internal_command(adapter_t *adapter, megacmd_t *mc, mega_passthru *pthru)

 	sdev = kzalloc(sizeof(struct scsi_device), GFP_KERNEL);
 	scmd->device = sdev;
+	if (!scmd->device) {
+		scsi_free_command(GFP_KERNEL, scmd);
+		return -ENOMEM;
+	}

 	memset(adapter->int_cdb, 0, sizeof(adapter->int_cdb));
 	scmd->cmnd = adapter->int_cdb;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-06-05  1:27 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-24  2:22 [PATCH] scsi: megaraid: check kzalloc Libo Chen
2013-05-24  3:20 ` Santosh Y
2013-05-24  9:30   ` Libo Chen
2013-05-24  9:40 ` [PATCH RESEND] " Libo Chen
2013-05-29 15:03   ` Tomas Henzl
2013-05-30  1:38     ` Libo Chen
2013-05-30  2:32       ` Libo Chen
2013-05-30 10:54         ` Tomas Henzl
2013-05-29 15:12   ` Tomas Henzl
2013-06-04  9:33   ` [PATCH v2] " Libo Chen
2013-06-04 12:14     ` Tomas Henzl
2013-06-05  1:27       ` Libo Chen

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).