Re: [Bug 49151] New: NULL pointer dereference in pata_acpi
From: Phillip Wood <hidden>
Date: 2012-10-24 09:28:47
From: Phillip Wood <hidden>
Date: 2012-10-24 09:28:47
On 10/23/2012 11:17 AM, Borislav Petkov wrote:
---diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c index 09723b76beac..80d594d6e7c8 100644 --- a/drivers/ata/pata_acpi.c +++ b/drivers/ata/pata_acpi.c@@ -144,6 +144,13 @@ static void pacpi_set_dmamode(struct ata_port *ap, struct ata_device *adev) /* Now stuff the nS values into the structure */ t = ata_timing_find_mode(adev->dma_mode); + if (!t) { + pr_err("%s: ata_timing_find_mode gives NULL; adev->dma_mode: 0x%x\n", + __func__, adev->dma_mode); + + return; + } + if (adev->dma_mode >= XFER_UDMA_0) { acpi->gtm.drive[unit].dma = t->udma; acpi->gtm.flags |= (1 << (2 * unit)); --
pacpi_set_dmamode: ata_timing_find_mode gives NULL; adev->dma_mode: 0x0 as well here if I build pata_acpi as a module, if I build it into the kernel I don't get any message.