Skip to content

Commit

Permalink
ide: Fix an overrun found in the CS5535 IDE driver
Browse files Browse the repository at this point in the history
As found by the Coverity checker, and reported by Adrian Bunk, this
fixes a overrun error in the CS5535 IDE driver.  Somebody got a little
excited with the if() statement - the CS5535 only supports UDMA 0-4.

Bart:
Not a bug per se since the upper layer will never feed this function
with speed > XFER_UDMA_4 (thanks to ->ultra_mask being set to 0x1f).

Worth fixing anyway.

Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
Cc: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
  • Loading branch information
Jordan Crouse authored and Bartlomiej Zolnierkiewicz committed Aug 1, 2007
1 parent 8d4fbcf commit 32a70a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/ide/pci/cs5535.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 32a70a8

Please sign in to comment.