[Skiboot] [PATCH] nvlink: Fix bad PE number check

Russell Currey ruscur at russell.cc
Mon Sep 5 16:20:53 AEST 2016


NPUs have 4 PEs which are zero indexed, so {0, 1, 2, 3}.  A bad PE number
check in npu_err_inject checks if the PE number is greater than 4 as a
fail case, so it would wrongly perform operations on a non-existant PE 4.

Reported-by: Gavin Shan <gwshan at linux.vnet.ibm.com>
Cc: stable
Signed-off-by: Russell Currey <ruscur at russell.cc>
---
 hw/npu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/npu.c b/hw/npu.c
index 54f9085..0682118 100644
--- a/hw/npu.c
+++ b/hw/npu.c
@@ -929,7 +929,7 @@ static int64_t npu_err_inject(struct phb *phb, uint64_t pe_number,
 	struct npu_dev *dev = NULL;
 	int i;
 
-	if (pe_number > NPU_NUM_OF_PES) {
+	if (pe_number >= NPU_NUM_OF_PES) {
 		prlog(PR_ERR, "NPU: error injection failed, bad PE given\n");
 		return OPAL_PARAMETER;
 	}
-- 
2.9.3



More information about the Skiboot mailing list