提交 cd708ef4 编写于 作者: M Matthias Bolte

storage: Remove PATH_MAX sized stack allocation from iSCSI backend

上级 651a9529
......@@ -408,12 +408,15 @@ static int
virStorageBackendISCSIFindLUs(virStoragePoolObjPtr pool,
const char *session)
{
char sysfs_path[PATH_MAX];
char *sysfs_path;
int retval = 0;
uint32_t host;
snprintf(sysfs_path, PATH_MAX,
"/sys/class/iscsi_session/session%s/device", session);
if (virAsprintf(&sysfs_path,
"/sys/class/iscsi_session/session%s/device", session) < 0) {
virReportOOMError();
return -1;
}
if (virStorageBackendSCSIGetHostNumber(sysfs_path, &host) < 0) {
virReportSystemError(errno,
......@@ -429,6 +432,8 @@ virStorageBackendISCSIFindLUs(virStoragePoolObjPtr pool,
retval = -1;
}
VIR_FREE(sysfs_path);
return retval;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册