From: Dan Carpenter Date: Wed, 30 Jan 2013 07:06:02 +0000 (+0300) Subject: [SCSI] libosd: check for kzalloc() failure X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=6d1f6621fa12800fc84f62db9e0b7a6b623eb439;p=linux-beck.git [SCSI] libosd: check for kzalloc() failure There wasn't any error handling for this kzalloc(). Signed-off-by: Dan Carpenter Acked-by: Boaz Harrosh Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c index c06b8e5aa2cf..d8293f25ca33 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);