stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Ben Collins <ben.c@servergy.com>,
	Sumit Saxena <sumit.saxena@lsi.com>,
	James Bottomley <JBottomley@Parallels.com>
Subject: [PATCH 3.4 7/8] SCSI: megaraid: Use resource_size_t for PCI resources, not long
Date: Thu, 12 Jun 2014 16:22:54 -0700	[thread overview]
Message-ID: <20140612232238.935311621@linuxfoundation.org> (raw)
In-Reply-To: <20140612232238.396722659@linuxfoundation.org>

3.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ben Collins <ben.c@servergy.com>

commit 11f8a7b31f2140b0dc164bb484281235ffbe51d3 upstream.

The assumption that sizeof(long) >= sizeof(resource_size_t) can lead to
truncation of the PCI resource address, meaning this driver didn't work
on 32-bit systems with 64-bit PCI adressing ranges.

Signed-off-by: Ben Collins <ben.c@servergy.com>
Acked-by: Sumit Saxena <sumit.saxena@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/scsi/megaraid/megaraid_sas.h      |    1 -
 drivers/scsi/megaraid/megaraid_sas_base.c |    5 +++--
 2 files changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -1294,7 +1294,6 @@ struct megasas_instance {
 	u32 *reply_queue;
 	dma_addr_t reply_queue_h;
 
-	unsigned long base_addr;
 	struct megasas_register_set __iomem *reg_set;
 
 	struct megasas_pd_list          pd_list[MEGASAS_MAX_PD];
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -3445,6 +3445,7 @@ static int megasas_init_fw(struct megasa
 	u32 max_sectors_1;
 	u32 max_sectors_2;
 	u32 tmp_sectors, msix_enable;
+	resource_size_t base_addr;
 	struct megasas_register_set __iomem *reg_set;
 	struct megasas_ctrl_info *ctrl_info;
 	unsigned long bar_list;
@@ -3453,14 +3454,14 @@ static int megasas_init_fw(struct megasa
 	/* Find first memory bar */
 	bar_list = pci_select_bars(instance->pdev, IORESOURCE_MEM);
 	instance->bar = find_first_bit(&bar_list, sizeof(unsigned long));
-	instance->base_addr = pci_resource_start(instance->pdev, instance->bar);
 	if (pci_request_selected_regions(instance->pdev, instance->bar,
 					 "megasas: LSI")) {
 		printk(KERN_DEBUG "megasas: IO memory region busy!\n");
 		return -EBUSY;
 	}
 
-	instance->reg_set = ioremap_nocache(instance->base_addr, 8192);
+	base_addr = pci_resource_start(instance->pdev, instance->bar);
+	instance->reg_set = ioremap_nocache(base_addr, 8192);
 
 	if (!instance->reg_set) {
 		printk(KERN_DEBUG "megasas: Failed to map IO mem\n");



  parent reply	other threads:[~2014-06-12 23:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-12 23:22 [PATCH 3.4 0/8] 3.4.94-stable review Greg Kroah-Hartman
2014-06-12 23:22 ` [PATCH 3.4 1/8] mlx4_en: dont use napi_synchronize inside mlx4_en_netpoll Greg Kroah-Hartman
2014-06-12 23:22 ` [PATCH 3.4 2/8] netfilter: ipv4: defrag: set local_df flag on defragmented skb Greg Kroah-Hartman
2014-06-12 23:22 ` [PATCH 3.4 3/8] powerpc: Fix 64 bit builds with binutils 2.24 Greg Kroah-Hartman
2014-06-12 23:22 ` [PATCH 3.4 4/8] zram: protect sysfs handler from invalid memory access Greg Kroah-Hartman
2014-06-12 23:22 ` [PATCH 3.4 5/8] Staging: zram: Fix memory leak by refcount mismatch Greg Kroah-Hartman
2014-06-12 23:22 ` [PATCH 3.4 6/8] auditsc: audit_krule mask accesses need bounds checking Greg Kroah-Hartman
2014-06-12 23:22 ` Greg Kroah-Hartman [this message]
2014-06-13  5:43 ` [PATCH 3.4 0/8] 3.4.94-stable review Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140612232238.935311621@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=JBottomley@Parallels.com \
    --cc=ben.c@servergy.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=sumit.saxena@lsi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).