projects/linux·commit 2e5991fa

Merge tag 'ata-5.18-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata

2e5991fa · Linus Torvalds <[email protected]> · 2022-04-22 18:09:49 -07:00

Pull ATA fix from Damien Le Moal:
 "A single fix to avoid a NULL pointer dereference in the pata_marvell
  driver with adapters not supporting DMA, from Zheyu"

* tag 'ata-5.18-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata:
  ata: pata_marvell: Check the 'bmdma_addr' beforing reading
Commit
2e5991fa39e4eec45eb37a680bfdff18129cefd9
Parents
bb4ce2c6 · aafa9f95

Merge commit. Changes below are compared with the first parent: bb4ce2c6.

Changes

1 files changed · +2 −0

FileStatusAddDelContent
drivers/ata/pata_marvell.cmodified+2−0View file

drivers/ata/pata_marvell.c

View file
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c
index 0c5a519..014ccb0 100644
--- a/drivers/ata/pata_marvell.c
+++ b/drivers/ata/pata_marvell.c
@@ -77,6 +77,8 @@ static int marvell_cable_detect(struct ata_port *ap)
switch(ap->port_no)
{
case 0:
+ if (!ap->ioaddr.bmdma_addr)
+ return ATA_CBL_PATA_UNK;
if (ioread8(ap->ioaddr.bmdma_addr + 1) & 1)
return ATA_CBL_PATA40;
return ATA_CBL_PATA80;