瀏覽代碼

NTB: Fix range check on memory window index

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>
Allen Hubbe 10 年之前
父節點
當前提交
9a07826f99
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/ntb/hw/intel/ntb_hw_intel.c

+ 1 - 1
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)
 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];
 }
 }