[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200710151442.52230.linux@highpoint-tech.com>
Date: Mon, 15 Oct 2007 14:42:52 +0800
From: HighPoint Linux Team <linux@...hpoint-tech.com>
To: "Andrew Morton" <akpm@...ux-foundation.org>,
linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: James.Bottomley@...elEye.com
Subject: [PATCH] hptiop: avoid buffer overflow when returning sense data
avoid buffer overflow when returning sense data.
Signed-off-by: HighPoint Linux Team <linux@...hpoint-tech.com>
---
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index 8b384fa..d32a4a9 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -375,8 +375,9 @@ static void hptiop_host_request_callback
scp->result = SAM_STAT_CHECK_CONDITION;
memset(&scp->sense_buffer,
0, sizeof(scp->sense_buffer));
- memcpy(&scp->sense_buffer,
- &req->sg_list, le32_to_cpu(req->dataxfer_length));
+ memcpy(&scp->sense_buffer, &req->sg_list,
+ min(sizeof(scp->sense_buffer),
+ le32_to_cpu(req->dataxfer_length)));
break;
default:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists