storage: Remove PATH_MAX sized stack allocation from iSCSI backend

This commit is contained in:
Matthias Bolte 2011-04-03 11:21:30 +02:00
parent 651a9529b2
commit cd708ef4ea

View File

@ -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;
}