aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorHighPoint Linux Team <linux@highpoint-tech.com>2007-10-15 02:42:52 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-10-17 21:56:13 -0400
commit0fec02c93f60fb44ba3a24a0d3e4a52521d34d3f (patch)
treef46f69d450964347e0251a81133ab7ac2af784d9 /drivers/scsi
parent7a39ac3f25bef018862a991d754aff681c019127 (diff)
[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>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/hptiop.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index 8515054cdf70..0844331abb87 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -375,8 +375,9 @@ static void hptiop_host_request_callback(struct hptiop_hba *hba, u32 _tag)
375 scp->result = SAM_STAT_CHECK_CONDITION; 375 scp->result = SAM_STAT_CHECK_CONDITION;
376 memset(&scp->sense_buffer, 376 memset(&scp->sense_buffer,
377 0, sizeof(scp->sense_buffer)); 377 0, sizeof(scp->sense_buffer));
378 memcpy(&scp->sense_buffer, 378 memcpy(&scp->sense_buffer, &req->sg_list,
379 &req->sg_list, le32_to_cpu(req->dataxfer_length)); 379 min(sizeof(scp->sense_buffer),
380 le32_to_cpu(req->dataxfer_length)));
380 break; 381 break;
381 382
382 default: 383 default: