From 55d20075bd0f66b24292cb229be355a2369a9a61 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Thu, 10 Mar 2016 15:34:02 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9066 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/common/abstractions/nasa_osal/src/osapi.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'os') diff --git a/os/common/abstractions/nasa_osal/src/osapi.c b/os/common/abstractions/nasa_osal/src/osapi.c index c4b55ed14..bd6448d2a 100644 --- a/os/common/abstractions/nasa_osal/src/osapi.c +++ b/os/common/abstractions/nasa_osal/src/osapi.c @@ -483,19 +483,16 @@ int32 OS_TimerCreate(uint32 *timer_id, const char *timer_name, return OS_ERR_NO_FREE_IDS; } - chSysLock(); - - strncpy(otp->name, timer_name, OS_MAX_API_NAME); + strncpy(otp->name, timer_name, OS_MAX_API_NAME - 1); chVTObjectInit(&otp->vt); otp->start_time = 0; otp->interval_time = 0; otp->callback_ptr = callback_ptr; otp->is_free = 0; /* Note, last.*/ + *timer_id = (uint32)otp; *clock_accuracy = (uint32)(1000000 / CH_CFG_ST_FREQUENCY); - chSysUnlock(); - return OS_SUCCESS; } @@ -727,7 +724,7 @@ int32 OS_QueueCreate(uint32 *queue_id, const char *queue_name, } /* Initializing object static parts.*/ - strncpy(oqp->name, queue_name, OS_MAX_API_NAME); + strncpy(oqp->name, queue_name, OS_MAX_API_NAME - 1); chMBObjectInit(&oqp->mb, oqp->q_buffer, (size_t)queue_depth); chSemObjectInit(&oqp->free_msgs, (cnt_t)queue_depth); chPoolObjectInit(&oqp->messages, msgsize, NULL); @@ -983,7 +980,7 @@ int32 OS_QueueGetInfo (uint32 queue_id, OS_queue_prop_t *queue_prop) { } strncpy(queue_prop->name, oqp->name, OS_MAX_API_NAME - 1); - queue_prop->creator = (uint32)0; + queue_prop->creator = (uint32)0; /* Leaving the critical zone.*/ chSysRestoreStatusX(sts); -- cgit v1.2.3