linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] cmd64x: potential buffer overflow in cmd64x_program_timings()
@ 2020-01-07 13:04 Dan Carpenter
  2020-01-07 13:06 ` [PATCH 2/2] ide: serverworks: potential overflow in svwks_set_pio_mode() Dan Carpenter
  2020-01-20 13:40 ` [PATCH 1/2] cmd64x: potential buffer overflow in cmd64x_program_timings() David Miller
  0 siblings, 2 replies; 15+ messages in thread
From: Dan Carpenter @ 2020-01-07 13:04 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-ide, kernel-janitors

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>
---
 drivers/ide/cmd64x.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/ide/cmd64x.c b/drivers/ide/cmd64x.c
index a1898e11b04e..943bf944bf72 100644
--- a/drivers/ide/cmd64x.c
+++ b/drivers/ide/cmd64x.c
@@ -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);
 
 	/*
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-01-30 10:03 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-07 13:04 [PATCH 1/2] cmd64x: potential buffer overflow in cmd64x_program_timings() Dan Carpenter
2020-01-07 13:06 ` [PATCH 2/2] ide: serverworks: potential overflow in svwks_set_pio_mode() Dan Carpenter
2020-01-20 13:40   ` David Miller
2020-01-21 11:18     ` Bartlomiej Zolnierkiewicz
2020-01-20 13:40 ` [PATCH 1/2] cmd64x: potential buffer overflow in cmd64x_program_timings() David Miller
2020-01-21 11:15   ` Bartlomiej Zolnierkiewicz
2020-01-21 11:48     ` Dan Carpenter
2020-01-21 11:55       ` Dan Carpenter
2020-01-21 12:07       ` Dan Carpenter
2020-01-21 12:21       ` Bartlomiej Zolnierkiewicz
2020-01-21 12:38         ` Bartlomiej Zolnierkiewicz
2020-01-21 13:06           ` [PATCH] ide: make drive->dn read only Dan Carpenter
2020-01-21 14:13             ` Bartlomiej Zolnierkiewicz
2020-01-21 14:17               ` Dan Carpenter
2020-01-30 10:03             ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).