From: Apeksha Gupta <apeksha.gu...@nxp.com>

Out-of-bounds read, Overrunning dynamic array nodes at offset corresponding
to index variable j.

Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation table")
Cc: sta...@dpdk.org

Signed-off-by: Apeksha Gupta <apeksha.gu...@nxp.com>
Signed-off-by: Vanshika Shukla <vanshika.shu...@nxp.com>
---
 drivers/common/dpaax/dpaax_iova_table.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/common/dpaax/dpaax_iova_table.c 
b/drivers/common/dpaax/dpaax_iova_table.c
index d2a78f4c19..860e702333 100644
--- a/drivers/common/dpaax/dpaax_iova_table.c
+++ b/drivers/common/dpaax/dpaax_iova_table.c
@@ -139,10 +139,12 @@ read_memory_node(unsigned int *count)
        }
 
        DPAAX_DEBUG("Device-tree memory node data:");
-       do {
+
+       while (j > 0) {
+               --j;
                DPAAX_DEBUG("    %08" PRIx64 " %08zu",
                            nodes[j].addr, nodes[j].len);
-       } while (--j);
+       }
 
 cleanup:
        close(fd);
-- 
2.25.1

Reply via email to