Skip to content

Commit

Permalink
ntb: initialize max_mw for Atom before using it
Browse files Browse the repository at this point in the history
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@intel.com>
Acked-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
  • Loading branch information
Daniel Verkamp authored and Jon Mason committed Jun 11, 2015
1 parent 2f4eb6a commit ebaad13
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/ntb/ntb_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ebaad13

Please sign in to comment.