Commit 9a07826f authored by Allen Hubbe's avatar Allen Hubbe Committed by Jon Mason

NTB: Fix range check on memory window index

The range check must exclude the upper bound.
Signed-off-by: default avatarAllen Hubbe <Allen.Hubbe@emc.com>
Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
parent 2aa2a77a
...@@ -240,7 +240,7 @@ static inline int ndev_ignore_unsafe(struct intel_ntb_dev *ndev, ...@@ -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) 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 -EINVAL;
return ndev->reg->mw_bar[idx]; return ndev->reg->mw_bar[idx];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment