lkml.org 
[lkml]   [2007]   [Jul]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: drivers/ide/pci/cs5535.c: array overrun
> 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.
[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];
\
 
 \ /
  Last update: 2007-07-24 18:03    [W:0.053 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site