diff options
author | Bart Van Assche <bart.vanassche@wdc.com> | 2017-08-25 22:46:40 +0200 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2017-08-25 23:08:08 +0200 |
commit | e1779b4ff5412fcb7f943f6b49cac5e70fc724e2 (patch) | |
tree | c3859142363d4cf5dae07aa0085929630a689b82 /drivers/scsi | |
parent | scsi: libsas: Annotate fall-through in a switch statement (diff) | |
download | linux-e1779b4ff5412fcb7f943f6b49cac5e70fc724e2.tar.xz linux-e1779b4ff5412fcb7f943f6b49cac5e70fc724e2.zip |
scsi: scsi_transport_sas: Check kzalloc() return value
Check whether memory allocation succeeded before dereferencing
the pointer to the allocated memory.
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/scsi_transport_sas.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index 5006a656e16a..e2e948f1ce28 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c @@ -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; |