From 321d2e3f03b0fe93762344501db4d87dfa5f7fa7 Mon Sep 17 00:00:00 2001 From: Lionel Gauthier <lionel.gauthier@eurecom.fr> Date: Thu, 9 Apr 2015 09:10:55 +0000 Subject: [PATCH] patches13/0005-fix-itti-message-broadcast-memory-handling-problem.patch git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7051 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- common/utils/itti/intertask_interface.c | 5 +++-- common/utils/itti/intertask_interface_types.h | 4 +++- openair1/SCHED/phy_procedures_lte_eNb.c | 2 +- targets/RT/USER/lte-softmodem.c | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/common/utils/itti/intertask_interface.c b/common/utils/itti/intertask_interface.c index caa8ad6d902..b831e23ba38 100644 --- a/common/utils/itti/intertask_interface.c +++ b/common/utils/itti/intertask_interface.c @@ -336,10 +336,11 @@ int itti_send_broadcast_message(MessageDef *message_p) { if (thread_id != origin_thread_id) { /* Skip tasks which are not running */ if (itti_desc.threads[thread_id].task_state == TASK_STATE_READY) { - new_message_p = itti_malloc (origin_task_id, destination_task_id, sizeof(MessageDef)); + size_t size = sizeof(MessageHeader) + message_p->ittiMsgHeader.ittiMsgSize; + new_message_p = itti_malloc( origin_task_id, destination_task_id, size ); AssertFatal (new_message_p != NULL, "New message allocation failed!\n"); - memcpy (new_message_p, message_p, sizeof(MessageDef)); + memcpy( new_message_p, message_p, size ); result = itti_send_msg_to_task (destination_task_id, INSTANCE_DEFAULT, new_message_p); AssertFatal (result >= 0, "Failed to send message %d to thread %d (task %d)!\n", message_p->ittiMsgHeader.messageId, thread_id, destination_task_id); } diff --git a/common/utils/itti/intertask_interface_types.h b/common/utils/itti/intertask_interface_types.h index 185eb9b485d..c1a0d02671f 100644 --- a/common/utils/itti/intertask_interface_types.h +++ b/common/utils/itti/intertask_interface_types.h @@ -145,8 +145,10 @@ typedef struct MessageHeader_s /** @struct MessageDef * @brief Message structure for inter-task communication. + * \internal + * The attached attribute \c __packed__ is neccessary, because the memory allocation code expects \ref ittiMsg directly following \ref ittiMsgHeader. */ -typedef struct MessageDef_s +typedef struct __attribute__ ((__packed__)) MessageDef_s { MessageHeader ittiMsgHeader; /**< Message header */ msg_t ittiMsg; /**< Union of payloads as defined in x_messages_def.h headers */ diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 74851b692f3..3c9605ead65 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1319,7 +1319,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e start_meas(&phy_vars_eNB->phy_proc_tx); #ifdef DEBUG_PHY_PROC - LOG_D(PHY,"[%s %"PRIu8"] Frame %d subframe %d : Doing phy_procedures_eNB_TX(%d)\n", + LOG_D(PHY,"[%s %"PRIu8"] Frame %d subframe %d : Doing phy_procedures_eNB_TX\n", (r_type == multicast_relay) ? "RN/eNB" : "eNB", phy_vars_eNB->Mod_id, frame, subframe); #endif diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 257a709bf79..074be3f3542 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1029,7 +1029,7 @@ static void * eNB_thread_tx(void *param) { (subframe_select(&PHY_vars_eNB_g[0][proc->CC_id]->lte_frame_parms,proc->subframe_tx)==SF_DL))|| (PHY_vars_eNB_g[0][proc->CC_id]->lte_frame_parms.frame_type == FDD))) { - phy_procedures_eNB_TX(proc->subframe,PHY_vars_eNB_g[0][proc->CC_id],0,no_relay,NULL); + phy_procedures_eNB_TX( proc->subframe, PHY_vars_eNB_g[0][proc->CC_id], 0, no_relay, NULL ); } if ((subframe_select(&PHY_vars_eNB_g[0][proc->CC_id]->lte_frame_parms,proc->subframe_tx)==SF_S)) { -- GitLab