From 3f930551ffc5038f3b4b67d112ae93f39844b310 Mon Sep 17 00:00:00 2001 From: Teodora Date: Fri, 4 Apr 2025 17:14:05 +0200 Subject: [PATCH] Fix CU to not contain the pointer for MAC/RLC stats Segmentation fault occured since the commit ID 9e5c5497abce7e6a47079e42a4a89168f75c35d2, where we try to copy the pointer which was not even been allocated. Before, we were copying the address of a NULL pointer and therefore no segmentation fault. This commit fixes the segmentation fault by checking if the memory was allocated, i.e. should not be in the case of CU (as it doesn't contain MAC/RLC layers). --- openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c index aaf46797ac..e887740402 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c @@ -115,7 +115,9 @@ static cudu_ue_info_pair_t fill_ue_related_info(arr_ue_id_t* arr_ue_id, const si if (arr_ue_id->ue_id[ue_idx].type == GNB_UE_ID_E2SM) { ue_info.rrc_ue_id = *arr_ue_id->ue_id[ue_idx].gnb.ran_ue_id; // rrc_ue_id - ue_info.ue = arr_ue_id->ue_info_list[ue_idx]; + if (arr_ue_id->ue_info_list != NULL) { + ue_info.ue = arr_ue_id->ue_info_list[ue_idx]; + } } else if (arr_ue_id->ue_id[ue_idx].type == GNB_CU_UP_UE_ID_E2SM) { /* in OAI implementation, CU-UP ue id = CU-CP ue id => CU-UP ue id = rrc_ue_id, but it should not be the case by the spec */