Commit e1779b4f authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen
Browse files

scsi: scsi_transport_sas: Check kzalloc() return value



Check whether memory allocation succeeded before dereferencing
the pointer to the allocated memory.

Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent e656f0d0
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -421,6 +421,9 @@ sas_tlr_supported(struct scsi_device *sdev)
	char *buffer = kzalloc(vpd_len, GFP_KERNEL);
	int ret = 0;

	if (!buffer)
		goto out;

	if (scsi_get_vpd_page(sdev, 0x90, buffer, vpd_len))
		goto out;