From fabf7e595f7f29a5a537f7d5dd960108d9f57332 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 7 Mar 2024 12:46:34 +0100 Subject: [PATCH] preventing crash caused by negative absolute slot RX value --- executables/nr-gnb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 2a12126d7d..86d0b42996 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -117,7 +117,10 @@ static void tx_func(void *param) int slot_rx = info->slot_rx; int absslot_tx = info->timestamp_tx / info->gNB->frame_parms.get_samples_per_slot(slot_tx, &info->gNB->frame_parms); int absslot_rx = absslot_tx - info->gNB->RU_list[0]->sl_ahead; - + if (absslot_rx < 0) { + LOG_W(NR_PHY, "Slot ahead %d is larger than absslot_tx %d. Cannot start TX yet.\n", info->gNB->RU_list[0]->sl_ahead, absslot_tx); + return; + } LOG_D(NR_PHY, "%d.%d running tx_func\n", frame_tx, slot_tx); PHY_VARS_gNB *gNB = info->gNB; module_id_t module_id = gNB->Mod_id;