提交 6d1f6621 编写于 作者: D Dan Carpenter 提交者: James Bottomley

[SCSI] libosd: check for kzalloc() failure

There wasn't any error handling for this kzalloc().
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Acked-by: NBoaz Harrosh <bharrosh@panasas.com>
Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
上级 50e92915
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册