Commit acf8ab9a authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Martin K. Petersen

scsi: ses: check return code from ses_recv_diag()

We should be checking the return code from ses_recv_diag() to avoid
accessing invalid data.
Signed-off-by: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent c8cd71f1
...@@ -179,7 +179,8 @@ static unsigned char *ses_get_page2_descriptor(struct enclosure_device *edev, ...@@ -179,7 +179,8 @@ static unsigned char *ses_get_page2_descriptor(struct enclosure_device *edev,
unsigned char *type_ptr = ses_dev->page1_types; unsigned char *type_ptr = ses_dev->page1_types;
unsigned char *desc_ptr = ses_dev->page2 + 8; unsigned char *desc_ptr = ses_dev->page2 + 8;
ses_recv_diag(sdev, 2, ses_dev->page2, ses_dev->page2_len); if (ses_recv_diag(sdev, 2, ses_dev->page2, ses_dev->page2_len) < 0)
return NULL;
for (i = 0; i < ses_dev->page1_num_types; i++, type_ptr += 4) { for (i = 0; i < ses_dev->page1_num_types; i++, type_ptr += 4) {
for (j = 0; j < type_ptr[1]; j++) { for (j = 0; j < type_ptr[1]; j++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment