Skip to content

Commit

Permalink
NTB: Fix range check on memory window index
Browse files Browse the repository at this point in the history
The range check must exclude the upper bound.

Signed-off-by: Allen Hubbe <[email protected]>
Signed-off-by: Jon Mason <[email protected]>
  • Loading branch information
Allen Hubbe authored and jonmason committed Sep 7, 2015
1 parent 2aa2a77 commit 9a07826
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/ntb/hw/intel/ntb_hw_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ static inline int ndev_ignore_unsafe(struct intel_ntb_dev *ndev,

static int ndev_mw_to_bar(struct intel_ntb_dev *ndev, int idx)
{
if (idx < 0 || idx > ndev->mw_count)
if (idx < 0 || idx >= ndev->mw_count)
return -EINVAL;
return ndev->reg->mw_bar[idx];
}
Expand Down

0 comments on commit 9a07826

Please sign in to comment.