Skip to content

Commit 117fcc3

Browse files
Dan Carpenterdavem330
authored andcommitted
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>
1 parent 0fdeae5 commit 117fcc3

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎drivers/ide/cmd64x.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ static void cmd64x_program_timings(ide_drive_t *drive, u8 mode)
6666
struct ide_timing t;
6767
u8 arttim = 0;
6868

69+
if (drive->dn >= ARRAY_SIZE(drwtim_regs))
70+
return;
71+
6972
ide_timing_compute(drive, mode, &t, T, 0);
7073

7174
/*

0 commit comments

Comments
 (0)