From: "Jordan Crouse" <jordan.crouse@amd.com>
To: bunk@stusta.de
Cc: bzolnier@gmail.com, linux-ide@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: drivers/ide/pci/cs5535.c: array overrun
Date: Tue, 24 Jul 2007 09:59:52 -0600 [thread overview]
Message-ID: <20070724155952.GA13874@cosmic.amd.com> (raw)
In-Reply-To: <20070724124524.GA6019@stusta.de>
[-- Attachment #1: Type: text/plain, Size: 411 bytes --]
> The Coverity checker spotted the following array overrun in
> drivers/ide/pci/cs5535.c:
<-- snip -->
> if (speed >= XFER_UDMA_0 && speed <= XFER_UDMA_7)
> reg |= cs5535_udma_timings[speed - XFER_UDMA_0];
Fix is attached. Somebody got overzealous - the 5535 only supports
up to UDMA4, which matches the array.
Jordan
--
Jordan Crouse
Systems Software Development Engineer
Advanced Micro Devices, Inc.
[-- Attachment #2: 5535-fix-overrun.patch --]
[-- Type: text/x-diff, Size: 1024 bytes --]
[PATCH] Fix an ovverun found in the 5535 IDE driver
From: Jordan Crouse <jordan.crouse@amd.com>
As found by the Coverity checker, and reported by Adrian Bunk, this
fixes a overrun error in the 5535 IDE driver. Somebody got a little
excited with the if() statement - the 5535 only supports UDMA 0-4.
Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
---
drivers/ide/pci/cs5535.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c
index ce44e38..9bd526d 100644
--- a/drivers/ide/pci/cs5535.c
+++ b/drivers/ide/pci/cs5535.c
@@ -116,7 +116,7 @@ static void cs5535_set_speed(ide_drive_t *drive, u8 speed)
reg &= 0x80000000UL; /* Preserve the PIO format bit */
- if (speed >= XFER_UDMA_0 && speed <= XFER_UDMA_7)
+ if (speed >= XFER_UDMA_0 && speed <= XFER_UDMA_4)
reg |= cs5535_udma_timings[speed - XFER_UDMA_0];
else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2)
reg |= cs5535_mwdma_timings[speed - XFER_MW_DMA_0];
next prev parent reply other threads:[~2007-07-24 16:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <06FDA0246543E443ABBB36B1FCD5CC0603CF3360@SAUSEXMB2.amd.com>
2007-07-24 12:45 ` drivers/ide/pci/cs5535.c: array overrun Adrian Bunk
2007-07-24 15:59 ` Jordan Crouse [this message]
2007-07-26 19:11 ` Bartlomiej Zolnierkiewicz
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=20070724155952.GA13874@cosmic.amd.com \
--to=jordan.crouse@amd.com \
--cc=bunk@stusta.de \
--cc=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@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).