NTB: Fix range check on memory window index
authorAllen Hubbe <Allen.Hubbe@emc.com>
Mon, 31 Aug 2015 13:31:00 +0000 (09:31 -0400)
committerJon Mason <jdmason@kudzu.us>
Mon, 7 Sep 2015 19:27:12 +0000 (15:27 -0400)
The range check must exclude the upper bound.

Signed-off-by: Allen Hubbe <Allen.Hubbe@emc.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
drivers/ntb/hw/intel/ntb_hw_intel.c

index fc6af2da8df05321f5b55f7c294a3f1707c3d5da..865a3e3cc581670bbd78a49166067ae955545de9 100644 (file)
@@ -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];
 }