Skip to contentSkip to conversation

pm80xx: Remove bogus address masking in pm8001_ioremap()

PATCH Applied David Daney 3 participants 3 messages Apr 13, 2016 – Apr 15, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pm80xx: Remove bogus address masking in pm8001_ioremap()

From: David Daney <[email protected]>

It is unclear what the original intent of the masking was, but it is clearly incorrect to truncate a physical address before calling ioremap(). On systems where there are valid physical address bits above bit-31 (arm64 for example) the result is an eventual OOPs when initializing the driver.

Remove the bogus code to fix it.

---
 drivers/scsi/pm8001/pm8001_init.c | 2 --
 1 file changed, 2 deletions(-)
drivers/scsi/pm8001/pm8001_init.c +0 -2
index 062ab34..6bd7bf4 100644
@@ -418,8 +418,6 @@ static int pm8001_ioremap(struct pm8001_hba_info *pm8001_ha)
 		if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
 			pm8001_ha->io_mem[logicalBar].membase =
 				pci_resource_start(pdev, bar);
-			pm8001_ha->io_mem[logicalBar].membase &=
-				(u32)PCI_BASE_ADDRESS_MEM_MASK;
 			pm8001_ha->io_mem[logicalBar].memsize =
 				pci_resource_len(pdev, bar);
 			pm8001_ha->io_mem[logicalBar].memvirtaddr =
Signature · 1 line
1.8.3.1
Acked-by on v1 1/1
#1 lore raw
Quoted 29 lines · David Daney

From: David Daney <[email protected]>

It is unclear what the original intent of the masking was, but it is clearly incorrect to truncate a physical address before calling ioremap(). On systems where there are valid physical address bits above bit-31 (arm64 for example) the result is an eventual OOPs when initializing the driver.

Remove the bogus code to fix it.

---
 drivers/scsi/pm8001/pm8001_init.c | 2 --
 1 file changed, 2 deletions(-)
drivers/scsi/pm8001/pm8001_init.c +0 -3
index 062ab34..6bd7bf4 100644
@@ -418,8 +418,6 @@ static int pm8001_ioremap(struct pm8001_hba_info *pm8001_ha)
                if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
                        pm8001_ha->io_mem[logicalBar].membase =
                                pci_resource_start(pdev, bar);
-                       pm8001_ha->io_mem[logicalBar].membase &=
-                               (u32)PCI_BASE_ADDRESS_MEM_MASK;
                        pm8001_ha->io_mem[logicalBar].memsize =
                                pci_resource_len(pdev, bar);
                        pm8001_ha->io_mem[logicalBar].memvirtaddr =
--
Quoted 2 lines

1.8.3.1

Thanks, looks good to me.

#2 lore raw
In reply to David Daney
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"David" == David Daney <[email protected]> writes:

David> It is unclear what the original intent of the masking was, but it David> is clearly incorrect to truncate a physical address before David> calling ioremap(). On systems where there are valid physical David> address bits above bit-31 (arm64 for example) the result is an David> eventual OOPs when initializing the driver.

David> Remove the bogus code to fix it.

Applied to 4.7/scsi-queue.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering