mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 12:44:11 +08:00
ide: serverworks: potential overflow in svwks_set_pio_mode()
The "drive->dn" variable is a u8 controlled by root. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
117fcc3053
commit
ce1f31b4c0
@ -115,6 +115,9 @@ static void svwks_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
|
||||
struct pci_dev *dev = to_pci_dev(hwif->dev);
|
||||
const u8 pio = drive->pio_mode - XFER_PIO_0;
|
||||
|
||||
if (drive->dn >= ARRAY_SIZE(drive_pci))
|
||||
return;
|
||||
|
||||
pci_write_config_byte(dev, drive_pci[drive->dn], pio_modes[pio]);
|
||||
|
||||
if (svwks_csb_check(dev)) {
|
||||
@ -141,6 +144,9 @@ static void svwks_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive)
|
||||
|
||||
u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0;
|
||||
|
||||
if (drive->dn >= ARRAY_SIZE(drive_pci2))
|
||||
return;
|
||||
|
||||
pci_read_config_byte(dev, (0x56|hwif->channel), &ultra_timing);
|
||||
pci_read_config_byte(dev, 0x54, &ultra_enable);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user