From: Alok Mishra <[email protected]>
In nix_inl_cpt_cq_cb(), the CPT CQ base address is reconstructed by
left-shifting CPT_LF_CQ_BASE.s.addr by 7 bits. Since s.addr is a 46-bit
field, the shift operation truncates the result to 46 bits, discarding
any higher address bits.
This produces an incorrect CQ base address for higher virtual
addresses, causing invalid memory access.
Fixed by casting s.addr to uint64_t before shifting, ensuring the full
64-bit address is preserved.
Fixes: 63b16e267106 ("common/cnxk: fix CPT CQ roll over handling")
Cc: [email protected]
Signed-off-by: Alok Mishra <[email protected]>
---
drivers/common/cnxk/roc_nix_inl_dev_irq.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/common/cnxk/roc_nix_inl_dev_irq.c
b/drivers/common/cnxk/roc_nix_inl_dev_irq.c
index dcf77a29a5..977b5e05e2 100644
--- a/drivers/common/cnxk/roc_nix_inl_dev_irq.c
+++ b/drivers/common/cnxk/roc_nix_inl_dev_irq.c
@@ -103,7 +103,8 @@ nix_inl_cpt_cq_cb(struct roc_cpt_lf *lf)
}
for (i = 0; i < count; i++) {
- cq_s = (struct cpt_cq_s *)(uintptr_t)(((cq_base.s.addr << 7)) +
(head << 5));
+ cq_s = (struct cpt_cq_s
*)(uintptr_t)((((uint64_t)cq_base.s.addr << 7)) +
+ (head << 5));
if (cq_s->w0.s.uc_compcode && cq_s->w0.s.compcode) {
switch (cq_s->w2.s.fmt & fmt_msk) {
--
2.34.1