From: Allen Hubbe Date: Mon, 31 Aug 2015 13:31:00 +0000 (-0400) Subject: NTB: Fix range check on memory window index X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=9a07826f99034202dad589285a47132685d9538b;p=openwrt%2Fstaging%2Fblogic.git NTB: Fix range check on memory window index The range check must exclude the upper bound. Signed-off-by: Allen Hubbe Signed-off-by: Jon Mason --- diff --git a/drivers/ntb/hw/intel/ntb_hw_intel.c b/drivers/ntb/hw/intel/ntb_hw_intel.c index fc6af2da8df0..865a3e3cc581 100644 --- a/drivers/ntb/hw/intel/ntb_hw_intel.c +++ b/drivers/ntb/hw/intel/ntb_hw_intel.c @@ -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]; }