Blob Blame History Raw
From: Karsten Graul <kgraul@linux.ibm.com>
Date: Fri, 2 Oct 2020 17:09:27 +0200
Subject: net/smc: use an array to check fields in system EID
Git-commit: fd6ebb6fb2cf30eb03fbb8949e367832cbb82fec
Patch-mainline: v5.10-rc1
References: jsc#SLE-13761

The check for old hardware versions that did not have SMCDv2 support was
using suspicious pointer magic. Address the fields using an array.

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
 net/smc/smc_ism.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/smc/smc_ism.c
+++ b/net/smc/smc_ism.c
@@ -335,7 +335,7 @@ int smcd_register_dev(struct smcd_dev *s
 		u8 *system_eid = NULL;
 
 		smc_ism_get_system_eid(smcd, &system_eid);
-		if ((*system_eid) + 24 != '0' || (*system_eid) + 28 != '0')
+		if (system_eid[24] != '0' || system_eid[28] != '0')
 			smc_ism_v2_capable = true;
 	}
 	/* sort list: devices without pnetid before devices with pnetid */