Linux ATA/IDE development
 help / color / mirror / Atom feed
* [PATCH] ata: pata_atiixp trivial fix
@ 2026-10-13  4:31 Ioannis Barkas
  2026-10-13  4:44 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Ioannis Barkas @ 2026-10-13  4:31 UTC (permalink / raw)
  To: linux-ide; +Cc: Ioannis Barkas

Reduce mwdma_timings to match its members

Signed-off-by: Ioannis Barkas jnyb.de@gmail.com
---
 drivers/ata/pata_atiixp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c
index 74ef9195bd..b4eb9c3f93 100644
--- a/drivers/ata/pata_atiixp.c
+++ b/drivers/ata/pata_atiixp.c
@@ -149,7 +149,7 @@ static void atiixp_set_piomode(struct ata_port *ap, struct ata_device *adev)
 
 static void atiixp_set_dmamode(struct ata_port *ap, struct ata_device *adev)
 {
-	static const u8 mwdma_timings[5] = { 0x77, 0x21, 0x20 };
+	static const u8 mwdma_timings[3] = { 0x77, 0x21, 0x20 };
 
 	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
 	int dma = adev->dma_mode;
-- 
2.53.0


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

* Re: [PATCH] ata: pata_atiixp trivial fix
  2026-10-13  4:31 [PATCH] ata: pata_atiixp trivial fix Ioannis Barkas
@ 2026-10-13  4:44 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-10-13  4:44 UTC (permalink / raw)
  To: Ioannis Barkas, linux-ide; +Cc: dlemoal, cassel

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] ata: out-of-bounds read in atiixp_set_dmamode() via libata.force
--

commit 6cef46d304d8efc0941f3fea452622301931fdb7
Author: Ioannis Barkas <jnyb.de@gmail.com>

ata: pata_atiixp trivial fix

Reduce mwdma_timings to match its members.

> diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c
> index 4c612f9543f6c..50f2c9077af05 100644
> --- a/drivers/ata/pata_atiixp.c
> +++ b/drivers/ata/pata_atiixp.c
> @@ -149,7 +149,7 @@ static void atiixp_set_piomode(struct ata_port *ap, struct ata_device *adev)
>  
>  static void atiixp_set_dmamode(struct ata_port *ap, struct ata_device *adev)
>  {
> -	static const u8 mwdma_timings[5] = { 0x77, 0x21, 0x20 };
> +	static const u8 mwdma_timings[3] = { 0x77, 0x21, 0x20 };

[Severity: Medium]
Does this code introduce an out-of-bounds read when libata.force is used?

If a user specifies libata.force=mwdma3 or mwdma4, ata_force_xfermask() can
override the hardware port limits and force adev->dma_mode to XFER_MW_DMA_3
or XFER_MW_DMA_4.

When atiixp_set_dmamode() is subsequently called, dma -= XFER_MW_DMA_0
evaluates to 3 or 4:

		dma -= XFER_MW_DMA_0;
		...
		mwdma_timing_data |= (mwdma_timings[dma] << timing_shift);

This would cause an out-of-bounds memory read since mwdma_timings was reduced
to 3 elements. The previous 5-element array provided safe zero-padding for
these forced modes.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261013043106.77115-1-jnyb.de@gmail.com?part=1

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

end of thread, other threads:[~2026-10-13  4:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13  4:31 [PATCH] ata: pata_atiixp trivial fix Ioannis Barkas
2026-10-13  4:44 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox