From: HighPoint Linux Team <linux@highpoint-tech.com>
To: Andrew Morton <akpm@linux-foundation.org>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: James.Bottomley@SteelEye.com
Subject: [PATCH] hptiop: avoid buffer overflow when returning sense data
Date: Mon, 15 Oct 2007 14:42:52 +0800 [thread overview]
Message-ID: <200710151442.52230.linux@highpoint-tech.com> (raw)
In-Reply-To: <200708291510.53793.linux@highpoint-tech.com>
avoid buffer overflow when returning sense data.
Signed-off-by: HighPoint Linux Team <linux@highpoint-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:
next prev parent reply other threads:[~2007-10-15 6:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200605101704.27491.linux@highpoint-tech.com>
[not found] ` <200605121107.48597.linux@highpoint-tech.com>
2006-05-16 6:38 ` [PATCH] hptiop: HighPoint RocketRAID 3xxx controller driver HighPoint Linux Team
2006-06-10 15:36 ` James Bottomley
2006-06-10 16:47 ` Andrew Morton
2006-06-10 18:11 ` James Bottomley
2007-08-29 7:10 ` [PATCH] hptiop: adding new firmware interface and more PCI device IDs HighPoint Linux Team
2007-08-29 10:39 ` Jeff Garzik
2007-08-30 10:06 ` [PATCH/RESENT] " HighPoint Linux Team
2007-08-30 10:53 ` Jeff Garzik
2007-10-15 6:42 ` HighPoint Linux Team [this message]
2007-10-15 6:40 ` [PATCH] hptiop: avoid buffer overflow when returning sense data Andrew Morton
2007-10-15 7:48 ` HighPoint Linux Team
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200710151442.52230.linux@highpoint-tech.com \
--to=linux@highpoint-tech.com \
--cc=James.Bottomley@SteelEye.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).