1
0
Fork 0

cmd64x: potential buffer overflow in cmd64x_program_timings()

The "drive->dn" value is a u8 and it is controlled by root only, but
it could be out of bounds here so let's check.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
alistair/sensors
Dan Carpenter 2020-01-07 16:04:41 +03:00 committed by David S. Miller
parent 0fdeae5036
commit 117fcc3053
1 changed files with 3 additions and 0 deletions

View 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);
/*