Project

General

Profile

Bug #13768 ยป issue-13768.patch

Carsten Grzemba, 2021-05-04 07:16 PM

View differences:

usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetMPLogicalUnitProperties.c
220 220
				MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES *pProps)
221 221
{
222 222
	mp_iocdata_t		mp_ioctl;
223
	mp_logical_unit_prop_t	luInfo;
223
	mp_logical_unit_prop_t	*luInfo;
224 224

  
225 225
	MP_OID overridePathOID;
226 226

  
......
250 250
		    " - error exit");
251 251
		return (MP_STATUS_FAILED);
252 252
	}
253

  
253
        
254
	luInfo = (mp_logical_unit_prop_t*) malloc(sizeof (mp_logical_unit_prop_t) + 4);
255
	if (luInfo == NULL) {
256
		log(LOG_INFO, "MP_GetMPLogicalUnitProperties()",
257
		    "cant allocate memory");
258
		log(LOG_INFO, "MP_GetMPLogicalUnitProperties()",
259
		    " - error exit");
260
		return (MP_STATUS_FAILED);
261
        }
262
 
254 263
	(void) memset(&mp_ioctl, 0, sizeof (mp_iocdata_t));
255
	(void) memset(&luInfo,   0, sizeof (mp_logical_unit_prop_t));
264
	(void) memset(luInfo,   0, sizeof (mp_logical_unit_prop_t));
256 265

  
257 266
	mp_ioctl.mp_cmd  = MP_GET_LU_PROP;
258 267
	mp_ioctl.mp_ibuf = (caddr_t)&oid.objectSequenceNumber;
259 268
	mp_ioctl.mp_ilen = sizeof (oid.objectSequenceNumber);
260
	mp_ioctl.mp_obuf = (caddr_t)&luInfo;
269
	mp_ioctl.mp_obuf = (caddr_t)luInfo;
261 270
	mp_ioctl.mp_olen = sizeof (mp_logical_unit_prop_t);
262 271
	mp_ioctl.mp_xfer = MP_XFER_READ;
263 272

  
......
297 306

  
298 307
	(void) memset(pProps, 0, sizeof (MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES));
299 308

  
300
	pProps->asymmetric = luInfo.asymmetric;
301
	pProps->autoFailbackEnabled = luInfo.autoFailbackEnabled;
302
	pProps->autoProbingEnabled = luInfo.autoProbingEnabled;
303
	pProps->currentFailbackPollingRate = luInfo.currentFailBackPollingRate;
304
	pProps->currentLoadBalanceType = luInfo.currentLoadBalanceType;
305
	pProps->currentProbingPollingRate = luInfo.currentProbingPollingRate;
309
	pProps->asymmetric = luInfo->asymmetric;
310
	pProps->autoFailbackEnabled = luInfo->autoFailbackEnabled;
311
	pProps->autoProbingEnabled = luInfo->autoProbingEnabled;
312
	pProps->currentFailbackPollingRate = luInfo->currentFailBackPollingRate;
313
	pProps->currentLoadBalanceType = luInfo->currentLoadBalanceType;
314
	pProps->currentProbingPollingRate = luInfo->currentProbingPollingRate;
306 315

  
307 316

  
308 317
	deviceFileName = getDeviceFileName(oid.objectSequenceNumber);
......
320 329
		free(deviceFileName);
321 330
	}
322 331

  
323
	pProps->failbackPollingRateMax = luInfo.failbackPollingRateMax;
324
	pProps->logicalUnitGroupID = luInfo.luGroupID;
332
	pProps->failbackPollingRateMax = luInfo->failbackPollingRateMax;
333
	pProps->logicalUnitGroupID = luInfo->luGroupID;
325 334

  
326
	(void) strncpy(pProps->name, luInfo.name, sizeof (pProps->name) - 1);
335
	(void) strncpy(pProps->name, luInfo->name, sizeof (pProps->name) - 1);
327 336

  
328
	pProps->nameType = luInfo.nameType;
337
	pProps->nameType = luInfo->nameType;
329 338

  
330
	overridePathOID.objectSequenceNumber = luInfo.overridePathID;
339
	overridePathOID.objectSequenceNumber = luInfo->overridePathID;
331 340
	overridePathOID.objectType = MP_OBJECT_TYPE_PATH_LU;
332 341
	overridePathOID.ownerId = g_pluginOwnerID;
333 342
	(void) memcpy(&pProps->overridePath, &overridePathOID, sizeof (MP_OID));
334 343

  
335
	pProps->probingPollingRateMax = luInfo.probingPollingRateMax;
344
	pProps->probingPollingRateMax = luInfo->probingPollingRateMax;
336 345

  
337 346

  
338 347
	vendorLength   = sizeof (pProps->vendor);
......
340 349
	revisionLength = sizeof (pProps->revision);
341 350

  
342 351
	(void) strncpy(pProps->vendor,
343
	    luInfo.prodInfo.vendor,
352
	    luInfo->prodInfo.vendor,
344 353
	    vendorLength);
345 354

  
346 355
	(void) strncpy(pProps->product,
347
	    luInfo.prodInfo.product,
356
	    luInfo->prodInfo.product,
348 357
	    productLength);
349 358

  
350 359
	(void) strncpy(pProps->revision,
351
	    luInfo.prodInfo.revision,
360
	    luInfo->prodInfo.revision,
352 361
	    revisionLength);
353 362

  
354 363
	log(LOG_INFO, "MP_GetMPLogicalUnitProperties()", " - exit");
364
       	free(luInfo);
355 365

  
356 366
	return (MP_STATUS_SUCCESS);
357 367
}
usr/src/lib/mpapi/libmpscsi_vhci/common/MP_GetPathLogicalUnitProperties.c
37 37
	MP_PATH_LOGICAL_UNIT_PROPERTIES *pProps)
38 38
{
39 39
	mp_iocdata_t   	mp_ioctl;
40
	mp_path_prop_t	pathInfo;
40
	mp_path_prop_t	*pathInfo;
41 41

  
42 42
	int ioctlStatus = 0;
43 43

  
......
65 65
		return (MP_STATUS_FAILED);
66 66
	}
67 67

  
68
	pathInfo = malloc(sizeof (mp_path_prop_t) + 4);
69
	if ( pathInfo == NULL ) {
70
		log(LOG_INFO, "MP_GetPathLogicalUnitProperties()",
71
		    "cant allocate memory");
72
		log(LOG_INFO, "MP_GetPathLogicalUnitProperties()",
73
			" - error exit");
74
		return (MP_STATUS_FAILED);
75
	}
68 76
	(void) memset(&mp_ioctl, 0, sizeof (mp_iocdata_t));
69
	(void) memset(&pathInfo, 0, sizeof (mp_path_prop_t));
77
	(void) memset(pathInfo, 0, sizeof (mp_path_prop_t));
70 78

  
71 79
	mp_ioctl.mp_cmd  = MP_GET_PATH_PROP;
72 80
	mp_ioctl.mp_ibuf = (caddr_t)&oid.objectSequenceNumber;
73 81
	mp_ioctl.mp_ilen = sizeof (oid.objectSequenceNumber);
74
	mp_ioctl.mp_obuf = (caddr_t)&pathInfo;
82
	mp_ioctl.mp_obuf = (caddr_t)pathInfo;
75 83
	mp_ioctl.mp_olen = sizeof (mp_path_prop_t);
76 84
	mp_ioctl.mp_xfer = MP_XFER_READ;
77 85

  
......
111 119

  
112 120
	(void) memset(pProps, 0, sizeof (MP_PATH_LOGICAL_UNIT_PROPERTIES));
113 121

  
114
	pProps->disabled = pathInfo.disabled;
122
	pProps->disabled = pathInfo->disabled;
115 123

  
116
	initPortOID.objectSequenceNumber = pathInfo.initPort.id;
124
	initPortOID.objectSequenceNumber = pathInfo->initPort.id;
117 125
	initPortOID.objectType = MP_OBJECT_TYPE_INITIATOR_PORT;
118 126
	initPortOID.ownerId = g_pluginOwnerID;
119 127

  
120 128
	(void) memcpy(&pProps->initiatorPortOid, &initPortOID, sizeof (MP_OID));
121 129

  
122
	targetPortOID.objectSequenceNumber = pathInfo.targetPort.id;
130
	targetPortOID.objectSequenceNumber = pathInfo->targetPort.id;
123 131
	targetPortOID.objectType = MP_OBJECT_TYPE_TARGET_PORT;
124 132
	targetPortOID.ownerId = g_pluginOwnerID;
125 133

  
126 134
	(void) memcpy(&pProps->targetPortOid, &targetPortOID, sizeof (MP_OID));
127 135

  
128
	luOID.objectSequenceNumber = pathInfo.logicalUnit.id;
136
	luOID.objectSequenceNumber = pathInfo->logicalUnit.id;
129 137
	luOID.objectType = MP_OBJECT_TYPE_MULTIPATH_LU;
130 138
	luOID.ownerId = g_pluginOwnerID;
131 139

  
132 140
	(void) memcpy(&pProps->logicalUnitOid, &luOID, sizeof (MP_OID));
133 141

  
134
	pProps->logicalUnitNumber = pathInfo.logicalUnit.id;
142
	pProps->logicalUnitNumber = pathInfo->logicalUnit.id;
135 143

  
136
	switch (pathInfo.pathState) {
144
	switch (pathInfo->pathState) {
137 145

  
138 146
		case MP_DRVR_PATH_STATE_ACTIVE:
139 147
		case MP_DRVR_PATH_STATE_PASSIVE:
......
165 173

  
166 174
	}
167 175

  
168
	pProps->weight = pathInfo.weight;
176
	pProps->weight = pathInfo->weight;
169 177

  
170 178

  
171 179
	log(LOG_INFO, "MP_GetPathLogicalUnitProperties()", " - exit");
180
	free(pathInfo);
172 181

  
173 182
	return (MP_STATUS_SUCCESS);
174 183
}
    (1-1/1)