From: Amit Kumar Salecha <amit.salecha@qlogic.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, ameen.rahman@qlogic.com
Subject: [PATCH 7/8] netxen: added sanity check for pci map
Date: Wed, 24 Mar 2010 06:29:22 -0700 [thread overview]
Message-ID: <1269437363-2606-8-git-send-email-amit.salecha@qlogic.com> (raw)
In-Reply-To: <1269437363-2606-1-git-send-email-amit.salecha@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Return value of ioremap is not checked, NULL check added.
---
drivers/net/netxen/netxen_nic_main.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 4c9caea..ee16aa2 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -636,10 +636,22 @@ netxen_setup_pci_map(struct netxen_adapter *adapter)
mem_ptr2 = ioremap(mem_base + THIRD_PAGE_GROUP_START,
THIRD_PAGE_GROUP_SIZE);
pci_len0 = FIRST_PAGE_GROUP_SIZE;
+
+ if (mem_ptr0 == NULL || mem_ptr1 == NULL || mem_ptr2 == NULL) {
+ dev_err(&pdev->dev, "failed to map PCI bar 0\n");
+ return -EIO;
+ }
+
} else if (mem_len == NETXEN_PCI_32MB_SIZE) {
mem_ptr1 = ioremap(mem_base, SECOND_PAGE_GROUP_SIZE);
mem_ptr2 = ioremap(mem_base + THIRD_PAGE_GROUP_START -
SECOND_PAGE_GROUP_START, THIRD_PAGE_GROUP_SIZE);
+
+ if (mem_ptr1 == NULL || mem_ptr2 == NULL) {
+ dev_err(&pdev->dev, "failed to map PCI bar 0\n");
+ return -EIO;
+ }
+
} else if (mem_len == NETXEN_PCI_2MB_SIZE) {
mem_ptr0 = pci_ioremap_bar(pdev, 0);
--
1.6.0.2
next prev parent reply other threads:[~2010-03-24 13:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-24 13:29 [PATCH 0/8]netxen: Validate and fix fw load Amit Kumar Salecha
2010-03-24 13:29 ` [PATCH 1/8] netxen: fix tx csum status Amit Kumar Salecha
2010-03-24 13:29 ` [PATCH 2/8] netxen: fix corner cases of firmware recovery Amit Kumar Salecha
2010-03-24 13:29 ` [PATCH 3/8] netxen: validate unified romimage Amit Kumar Salecha
2010-03-24 13:29 ` [PATCH 4/8] netxen: fix bios version calculation Amit Kumar Salecha
2010-03-24 13:29 ` [PATCH 5/8] netxen: fix fw load from file Amit Kumar Salecha
2010-03-24 13:29 ` [PATCH 6/8] netxen: fix warning in ioaddr for NX3031 chip Amit Kumar Salecha
2010-03-24 13:29 ` Amit Kumar Salecha [this message]
2010-03-24 18:46 ` [PATCH 7/8] netxen: added sanity check for pci map David Miller
2010-03-24 13:29 ` [PATCH 8/8] netxen: update version to 4.0.73 Amit Kumar Salecha
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=1269437363-2606-8-git-send-email-amit.salecha@qlogic.com \
--to=amit.salecha@qlogic.com \
--cc=ameen.rahman@qlogic.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/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