cmd64x: potential buffer overflow in cmd64x_program_timings()
[linux-2.6-microblaze.git] / drivers / ide / cmd64x.c
index a1898e1..943bf94 100644 (file)
@@ -66,6 +66,9 @@ static void cmd64x_program_timings(ide_drive_t *drive, u8 mode)
        struct ide_timing t;
        u8 arttim = 0;
 
+       if (drive->dn >= ARRAY_SIZE(drwtim_regs))
+               return;
+
        ide_timing_compute(drive, mode, &t, T, 0);
 
        /*