mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
storage: Remove PATH_MAX sized stack allocation from iSCSI backend
This commit is contained in:
parent
651a9529b2
commit
cd708ef4ea
@ -408,12 +408,15 @@ static int
|
|||||||
virStorageBackendISCSIFindLUs(virStoragePoolObjPtr pool,
|
virStorageBackendISCSIFindLUs(virStoragePoolObjPtr pool,
|
||||||
const char *session)
|
const char *session)
|
||||||
{
|
{
|
||||||
char sysfs_path[PATH_MAX];
|
char *sysfs_path;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
uint32_t host;
|
uint32_t host;
|
||||||
|
|
||||||
snprintf(sysfs_path, PATH_MAX,
|
if (virAsprintf(&sysfs_path,
|
||||||
"/sys/class/iscsi_session/session%s/device", session);
|
"/sys/class/iscsi_session/session%s/device", session) < 0) {
|
||||||
|
virReportOOMError();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (virStorageBackendSCSIGetHostNumber(sysfs_path, &host) < 0) {
|
if (virStorageBackendSCSIGetHostNumber(sysfs_path, &host) < 0) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
@ -429,6 +432,8 @@ virStorageBackendISCSIFindLUs(virStoragePoolObjPtr pool,
|
|||||||
retval = -1;
|
retval = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VIR_FREE(sysfs_path);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user