public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] [SCSI] libosd: check for kzalloc() failure
@ 2013-01-30  7:06 Dan Carpenter
  2013-01-30  8:15 ` walter harms
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Dan Carpenter @ 2013-01-30  7:06 UTC (permalink / raw)
  To: Boaz Harrosh
  Cc: Benny Halevy, James E.J. Bottomley, osd-dev, linux-scsi,
	kernel-janitors

There wasn't any error handling for this kzalloc().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c
index c06b8e5..d8293f2 100644
--- a/drivers/scsi/osd/osd_initiator.c
+++ b/drivers/scsi/osd/osd_initiator.c
@@ -144,6 +144,10 @@ static int _osd_get_print_system_info(struct osd_dev *od,
 	odi->osdname_len = get_attrs[a].len;
 	/* Avoid NULL for memcmp optimization 0-length is good enough */
 	odi->osdname = kzalloc(odi->osdname_len + 1, GFP_KERNEL);
+	if (!odi->osdname) {
+		ret = -ENOMEM;
+		goto out;
+	}
 	if (odi->osdname_len)
 		memcpy(odi->osdname, get_attrs[a].val_ptr, odi->osdname_len);
 	OSD_INFO("OSD_NAME               [%s]\n", odi->osdname);

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

end of thread, other threads:[~2013-01-30 15:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-30  7:06 [patch] [SCSI] libosd: check for kzalloc() failure Dan Carpenter
2013-01-30  8:15 ` walter harms
2013-01-30  8:27   ` Dan Carpenter
2013-01-30  8:57     ` walter harms
2013-01-30  9:51       ` Benny Halevy
2013-01-30 13:00         ` walter harms
2013-01-30 13:40           ` Benny Halevy
2013-01-30 14:34             ` walter harms
2013-01-30 15:51               ` Boaz Harrosh
2013-01-30 10:05 ` Benny Halevy
2013-01-30 15:56 ` Boaz Harrosh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox