linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pm80xx: Remove bogus address masking in pm8001_ioremap()
@ 2016-04-13 21:26 David Daney
  2016-04-14 12:22 ` Jinpu Wang
  2016-04-15  2:38 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: David Daney @ 2016-04-13 21:26 UTC (permalink / raw)
  To: Jack Wang, lindar_liu, James E.J. Bottomley, Martin K. Petersen,
	pmchba, linux-scsi
  Cc: linux-kernel, David Daney

From: David Daney <david.daney@cavium.com>

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.

Signed-off-by: David Daney <david.daney@cavium.com>
---
 drivers/scsi/pm8001/pm8001_init.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
index 062ab34..6bd7bf4 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -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 =
-- 
1.8.3.1

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

* Re: [PATCH] pm80xx: Remove bogus address masking in pm8001_ioremap()
  2016-04-13 21:26 [PATCH] pm80xx: Remove bogus address masking in pm8001_ioremap() David Daney
@ 2016-04-14 12:22 ` Jinpu Wang
  2016-04-15  2:38 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Jinpu Wang @ 2016-04-14 12:22 UTC (permalink / raw)
  To: David Daney
  Cc: lindar_liu, James E.J. Bottomley, Martin K. Petersen, pmchba,
	linux-scsi, linux-kernel@vger.kernel.org, David Daney

On Wed, Apr 13, 2016 at 11:26 PM, David Daney <ddaney.cavm@gmail.com> wrote:
> From: David Daney <david.daney@cavium.com>
>
> 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.
>
> Signed-off-by: David Daney <david.daney@cavium.com>
> ---
>  drivers/scsi/pm8001/pm8001_init.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
> index 062ab34..6bd7bf4 100644
> --- a/drivers/scsi/pm8001/pm8001_init.c
> +++ b/drivers/scsi/pm8001/pm8001_init.c
> @@ -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 =
> --
> 1.8.3.1
>

Thanks, looks good to me.
Acked-by: Jack Wang <jinpu.wang@profitbricks.com>

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

* Re: [PATCH] pm80xx: Remove bogus address masking in pm8001_ioremap()
  2016-04-13 21:26 [PATCH] pm80xx: Remove bogus address masking in pm8001_ioremap() David Daney
  2016-04-14 12:22 ` Jinpu Wang
@ 2016-04-15  2:38 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2016-04-15  2:38 UTC (permalink / raw)
  To: David Daney
  Cc: Jack Wang, lindar_liu, James E.J. Bottomley, Martin K. Petersen,
	pmchba, linux-scsi, linux-kernel, David Daney

>>>>> "David" == David Daney <ddaney.cavm@gmail.com> 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.

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2016-04-15  2:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-13 21:26 [PATCH] pm80xx: Remove bogus address masking in pm8001_ioremap() David Daney
2016-04-14 12:22 ` Jinpu Wang
2016-04-15  2:38 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).