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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0fdeae5 commit 117fcc3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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)