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
Unified · Split
| @@ -77,6 +77,8 @@ static int marvell_cable_detect(struct ata_port *ap) · 76 unmodified lines | |||
| 77 | switch(ap->port_no) | 77 | switch(ap->port_no) |
| 78 | { | 78 | { |
| 79 | case 0: | 79 | case 0: |
| 80 | if (!ap->ioaddr.bmdma_addr) | ||
| 81 | return ATA_CBL_PATA_UNK; | ||
| 80 | if (ioread8(ap->ioaddr.bmdma_addr + 1) & 1) | 82 | if (ioread8(ap->ioaddr.bmdma_addr + 1) & 1) |
| 81 | return ATA_CBL_PATA40; | 83 | return ATA_CBL_PATA40; |
| 82 | return ATA_CBL_PATA80; | 84 | return ATA_CBL_PATA80; |