From: Allen Hubbe Date: Mon, 31 Aug 2015 13:31:00 +0000 (-0400) Subject: NTB: Fix range check on memory window index X-Git-Tag: firefly_0821_release~176^2~1070^2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9a07826f99034202dad589285a47132685d9538b;p=firefly-linux-kernel-4.4.55.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]; }