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
This commit is contained in:
Lionel Gauthier
2015-04-09 09:10:55 +00:00
parent 07d3f84fe6
commit 321d2e3f03
4 changed files with 8 additions and 5 deletions
+3 -2
View File
@@ -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);
}
@@ -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 */