From 5f7a5dbf02f79076d628214cd5f4ab55191716d8 Mon Sep 17 00:00:00 2001 From: Amrathesh Date: Fri, 18 Jul 2025 12:36:51 +0530 Subject: [PATCH] fix(pcie): move next_bdf label to avoid array out of bound - Fixes: #28 - Having jump label inside loop bypassed the check for bounds. - Moved it outside to prevent the sceanrio. Signed-off-by: Amrathesh Change-Id: I5b64d03ec96703f26df79565a46c1e69dcabb2c7 --- test_pool/pcie/p038.c | 4 ++-- test_pool/pcie/p073.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test_pool/pcie/p038.c b/test_pool/pcie/p038.c index 831822f9..6d7c23a7 100644 --- a/test_pool/pcie/p038.c +++ b/test_pool/pcie/p038.c @@ -52,9 +52,9 @@ payload(void) bdf_tbl_ptr = val_pcie_bdf_table_ptr(); pe_index = val_pe_get_index_mpid(val_pe_get_mpid()); +next_bdf: while (tbl_index < bdf_tbl_ptr->num_entries) { - next_bdf: bdf = bdf_tbl_ptr->device[tbl_index++].bdf; dp_type = val_pcie_device_port_type(bdf); @@ -81,7 +81,7 @@ payload(void) if (ecam_base == rp_ecam_base && segment == rp_segment) { val_print(ACS_PRINT_DEBUG, - "\n ECAM base 0x%x matches with RPs base address ", ecam_base); + "\n ECAM base 0x%llx matches with RPs base address ", ecam_base); goto next_bdf; } diff --git a/test_pool/pcie/p073.c b/test_pool/pcie/p073.c index a17521ef..e9213eb7 100644 --- a/test_pool/pcie/p073.c +++ b/test_pool/pcie/p073.c @@ -53,9 +53,9 @@ payload(void) bdf_tbl_ptr = val_pcie_bdf_table_ptr(); pe_index = val_pe_get_index_mpid(val_pe_get_mpid()); +next_bdf: while (tbl_index < bdf_tbl_ptr->num_entries) { - next_bdf: bdf = bdf_tbl_ptr->device[tbl_index++].bdf; dp_type = val_pcie_device_port_type(bdf); @@ -82,7 +82,7 @@ payload(void) if (ecam_base == rp_ecam_base && segment == rp_segment) { val_print(ACS_PRINT_DEBUG, - "\n ECAM base 0x%x matches with RPs base address ", ecam_base); + "\n ECAM base 0x%llx matches with RPs base address ", ecam_base); goto next_bdf; }