diff --git a/packages/ti/sdo/ipc/nsremote/NameServerMessageQ.c b/packages/ti/sdo/ipc/nsremote/NameServerMessageQ.c
index b4007658110dc2e7ab932736a7d75be08bc27179..1f0b3a61483db4e5130f76a1d3d4cd403b5c7898 100644 (file)
/*
/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
*/
#define MAXNAMEINCHAR (NameServerMessageQ_maxNameLen / \
(xdc_target__bitsPerChar / 8))
*/
#define MAXNAMEINCHAR (NameServerMessageQ_maxNameLen / \
(xdc_target__bitsPerChar / 8))
-#define NAMEARRAYSZIE (((MAXNAMEINCHAR - 1) / sizeof(Bits32)) + 1)
+#define NAMEARRAYSIZE (((MAXNAMEINCHAR - 1) / sizeof(Bits32)) + 1)
#define MESSAGEQ_INDEX 0
#define MESSAGEQ_INDEX 0
Bits32 requestStatus; /* status of request */
Bits32 reserved; /* reserved field */
/* name of NameServer instance */
Bits32 requestStatus; /* status of request */
Bits32 reserved; /* reserved field */
/* name of NameServer instance */
- Bits32 instanceName[NAMEARRAYSZIE];
+ Bits32 instanceName[NAMEARRAYSIZE];
/* name of NameServer entry */
/* name of NameServer entry */
- Bits32 name[NAMEARRAYSZIE];
+ Bits32 name[NAMEARRAYSIZE];
} NameServerMsg;
/*
} NameServerMsg;
/*
Int NameServerMessageQ_Module_startup(Int phase)
{
MessageQ_Params2 messageQParams;
Int NameServerMessageQ_Module_startup(Int phase)
{
MessageQ_Params2 messageQParams;
+ MessageQ_QueueId queueId;
/* Ensure MessageQ and SyncSwi Module_startup() have completed */
if ((ti_sdo_ipc_MessageQ_Module_startupDone() == FALSE) ||
/* Ensure MessageQ and SyncSwi Module_startup() have completed */
if ((ti_sdo_ipc_MessageQ_Module_startupDone() == FALSE) ||
/* assert msgHandle is not null */
Assert_isTrue(NameServerMessageQ_module->msgHandle != NULL,
Ipc_A_nullPointer);
/* assert msgHandle is not null */
Assert_isTrue(NameServerMessageQ_module->msgHandle != NULL,
Ipc_A_nullPointer);
+ /* Additonal check for case with assert disabled */
+ if(NameServerMessageQ_module->msgHandle == NULL) {
+ return Startup_NOTDONE;
+ }
+ queueId = MessageQ_getQueueId((MessageQ_Handle)
+ NameServerMessageQ_module->msgHandle);
/* assert this is the first MessageQ created */
/* assert this is the first MessageQ created */
- Assert_isTrue((MessageQ_getQueueId((MessageQ_Handle)
- NameServerMessageQ_module->msgHandle) & 0xffff) == MESSAGEQ_INDEX,
+ Assert_isTrue( (queueId & 0xffff) == MESSAGEQ_INDEX,
NameServerMessageQ_A_reservedMsgQueueId);
NameServerMessageQ_A_reservedMsgQueueId);
+ /* Additonal check for case with assert disabled */
+ if ((queueId & 0xffff) != MESSAGEQ_INDEX) {
+ return Startup_NOTDONE;
+ }
return (Startup_DONE);
}
return (Startup_DONE);
}
ISync_Handle syncHandle,
Error_Block *eb)
{
ISync_Handle syncHandle,
Error_Block *eb)
{
- Int len;
Int status;
IArg key;
MessageQ_QueueId queueId;
Int status;
IArg key;
MessageQ_QueueId queueId;
msg->request = NameServerMessageQ_REQUEST;
msg->requestStatus = 0;
msg->request = NameServerMessageQ_REQUEST;
msg->requestStatus = 0;
- /* get the length of instanceName */
- len = strlen(instanceName);
-
/* assert length is smaller than max (must have room for null character) */
/* assert length is smaller than max (must have room for null character) */
- Assert_isTrue(len < MAXNAMEINCHAR, NameServerMessageQ_A_nameIsTooLong);
+ Assert_isTrue(strlen(instanceName) < MAXNAMEINCHAR,
+ NameServerMessageQ_A_nameIsTooLong);
/* copy the name of instance into putMsg */
/* copy the name of instance into putMsg */
- strncpy((Char *)msg->instanceName, instanceName, len);
-
- /* get the length of name */
- len = strlen(name);
+ strncpy((Char *)msg->instanceName, instanceName, MAXNAMEINCHAR - 1);
+ ((Char *)msg->instanceName) [MAXNAMEINCHAR - 1] = '0';
/* assert length is smaller than max (must have room for null character) */
/* assert length is smaller than max (must have room for null character) */
- Assert_isTrue(len < MAXNAMEINCHAR, NameServerMessageQ_A_nameIsTooLong);
+ Assert_isTrue(strlen(name) < MAXNAMEINCHAR,
+ NameServerMessageQ_A_nameIsTooLong);
/* copy the name of nameserver entry into putMsg */
/* copy the name of nameserver entry into putMsg */
- strncpy((Char *)msg->name, name, len);
+ strncpy((Char *)msg->name, name, MAXNAMEINCHAR - 1);
+ ((Char *)msg->name) [MAXNAMEINCHAR - 1] = '0';
/* determine the queueId based upon the processor */
queueId = MessageQ_openQueueId(MESSAGEQ_INDEX, obj->remoteProcId);
/* determine the queueId based upon the processor */
queueId = MessageQ_openQueueId(MESSAGEQ_INDEX, obj->remoteProcId);