提交 ad5fa025 编写于 作者: J Joe Carnuccio 提交者: James Bottomley

[SCSI] qla2xxx: Fix undefined behavior in call to snprintf().

Signed-off-by: NJoe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: NSaurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
上级 db64e930
...@@ -917,8 +917,8 @@ qla2x00_serial_num_show(struct device *dev, struct device_attribute *attr, ...@@ -917,8 +917,8 @@ qla2x00_serial_num_show(struct device *dev, struct device_attribute *attr,
return snprintf(buf, PAGE_SIZE, "%s\n", return snprintf(buf, PAGE_SIZE, "%s\n",
vha->hw->mr.serial_num); vha->hw->mr.serial_num);
} else if (IS_FWI2_CAPABLE(ha)) { } else if (IS_FWI2_CAPABLE(ha)) {
qla2xxx_get_vpd_field(vha, "SN", buf, PAGE_SIZE); qla2xxx_get_vpd_field(vha, "SN", buf, PAGE_SIZE - 1);
return snprintf(buf, PAGE_SIZE, "%s\n", buf); return strlen(strcat(buf, "\n"));
} }
sn = ((ha->serial0 & 0x1f) << 16) | (ha->serial2 << 8) | ha->serial1; sn = ((ha->serial0 & 0x1f) << 16) | (ha->serial2 << 8) | ha->serial1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册