[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1431557404-34597-1-git-send-email-daniel.verkamp@intel.com>
Date: Wed, 13 May 2015 15:50:04 -0700
From: Daniel Verkamp <daniel.verkamp@...el.com>
To: Jon Mason <jdmason@...zu.us>
Cc: Dave Jiang <dave.jiang@...el.com>, linux-kernel@...r.kernel.org,
linux-pci@...r.kernel.org,
Daniel Verkamp <daniel.verkamp@...el.com>
Subject: [PATCH v2] ntb: initialize max_mw for Atom before using it
Commit ab760a0 (ntb: Adding split BAR support for Haswell platforms)
changed ntb_device's mw from a fixed-size array into a pointer that is
allocated based on limits.max_mw; however, on Atom platforms, max_mw
is not initialized until ntb_device_setup(), which happens after the
allocation.
Fill out max_mw in ntb_atom_detect() to match ntb_xeon_detect(); this
happens before the use of max_mw in the ndev->mw allocation.
Fixes a null pointer dereference on Atom platforms with ntb hardware.
v2: fix typo (mw_max should be max_mw)
Signed-off-by: Daniel Verkamp <daniel.verkamp@...el.com>
Acked-by: Dave Jiang <dave.jiang@...el.com>
---
drivers/ntb/ntb_hw.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/ntb/ntb_hw.c b/drivers/ntb/ntb_hw.c
index cd29b10..d14ca0d 100644
--- a/drivers/ntb/ntb_hw.c
+++ b/drivers/ntb/ntb_hw.c
@@ -1660,6 +1660,7 @@ static int ntb_atom_detect(struct ntb_device *ndev)
u32 ppd;
ndev->hw_type = BWD_HW;
+ ndev->limits.max_mw = BWD_MAX_MW;
rc = pci_read_config_dword(ndev->pdev, NTB_PPD_OFFSET, &ppd);
if (rc)
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists