[SCSI] hptiop: avoid buffer overflow when returning sense data

The newer firmware may return more than 96 bytes of sense data when it
does autosense.  Truncate this to the size of the SCSI layer sense
buffer to avoid an overrun.

Signed-off-by: HighPoint Linux Team <linux@highpoint-tech.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
HighPoint Linux Team 2007-10-15 14:42:52 +08:00 коммит произвёл James Bottomley
Родитель 7a39ac3f25
Коммит 0fec02c93f
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -375,8 +375,9 @@ static void hptiop_host_request_callback(struct hptiop_hba *hba, u32 _tag)
scp->result = SAM_STAT_CHECK_CONDITION; scp->result = SAM_STAT_CHECK_CONDITION;
memset(&scp->sense_buffer, memset(&scp->sense_buffer,
0, sizeof(scp->sense_buffer)); 0, sizeof(scp->sense_buffer));
memcpy(&scp->sense_buffer, memcpy(&scp->sense_buffer, &req->sg_list,
&req->sg_list, le32_to_cpu(req->dataxfer_length)); min(sizeof(scp->sense_buffer),
le32_to_cpu(req->dataxfer_length)));
break; break;
default: default: