From f1fdff80a08e331d0d98f874eda0c5b86b488862 Mon Sep 17 00:00:00 2001
From: Dong Anyuan <donganyuan@cn.fujitsu.com>
Date: Thu, 20 Jun 2019 13:59:53 +0900
Subject: [PATCH] Fix Coverity Scan CID 340235 (Using variable UE_id_mac as an
 index to array RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl.)

---
 openair2/RRC/LTE/rrc_eNB.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c
index aaffe7f177..9c9c1d644f 100644
--- a/openair2/RRC/LTE/rrc_eNB.c
+++ b/openair2/RRC/LTE/rrc_eNB.c
@@ -5536,6 +5536,10 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
   if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) {
     /* CDRX: activated if ack was expected */
     int UE_id_mac = find_UE_id(ctxt_pP->module_id, ue_context_pP->ue_context.rnti);
+    if (UE_id_mac == -1){
+      LOG_E(RRC,PROTOCOL_RRC_CTXT_UE_FMT" rrc_eNB_process_RRCConnectionReconfigurationComplete without UE_id(MAC) rnti %x, let's return\n",PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ue_context_pP->ue_context.rnti);
+      return;
+    }
     UE_sched_ctrl *UE_scheduling_control = &(RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id_mac]);
     
     if (UE_scheduling_control->cdrx_waiting_ack == TRUE) {
-- 
GitLab