[Pdbg] [PATCH] adu: Avoid address truncation from 64-bit to 32-bit

Amitay Isaacs amitay at ozlabs.org
Fri Sep 21 17:18:43 AEST 2018


Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
 libpdbg/adu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libpdbg/adu.c b/libpdbg/adu.c
index 27049b7..e956b71 100644
--- a/libpdbg/adu.c
+++ b/libpdbg/adu.c
@@ -368,7 +368,7 @@ retry:
 	CHECK_ERR(adu_reset(adu));
 
 	/* Set the address */
-	ctrl_reg = SETFIELD(P9_FBC_ALTD_ADDRESS, 0, addr);
+	ctrl_reg = SETFIELD(P9_FBC_ALTD_ADDRESS, 0ULL, addr);
 	CHECK_ERR(pib_write(&adu->target, P9_ALTD_CONTROL_REG, ctrl_reg));
 
 	/* Start the command */
@@ -420,7 +420,7 @@ static int p9_adu_putmem(struct adu *adu, uint64_t addr, uint64_t data, int size
 	CHECK_ERR(adu_reset(adu));
 
 	/* Set the address */
-	ctrl_reg = SETFIELD(P9_FBC_ALTD_ADDRESS, 0, addr);
+	ctrl_reg = SETFIELD(P9_FBC_ALTD_ADDRESS, 0ULL, addr);
 retry:
 	CHECK_ERR(pib_write(&adu->target, P9_ALTD_CONTROL_REG, ctrl_reg));
 
-- 
2.17.1



More information about the Pdbg mailing list