summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 876ddae)
raw | patch | inline | side by side (parent: 876ddae)
author | Justin Sobota <jsobota@ti.com> | |
Wed, 11 Jun 2014 20:21:28 +0000 (16:21 -0400) | ||
committer | Justin Sobota <jsobota@ti.com> | |
Wed, 11 Jun 2014 20:21:28 +0000 (16:21 -0400) |
12 files changed:
include/rm_internal.h | patch | blob | history | |
package.xdc | patch | blob | history | |
rm.h | patch | blob | history | |
rmver.h | patch | blob | history | |
rmver.h.xdt | patch | blob | history | |
src/rm.c | patch | blob | history | |
src/rm_allocator.c | patch | blob | history | |
src/rm_dtb_util.c | patch | blob | history | |
src/rm_nameserver.c | patch | blob | history | |
src/rm_policy.c | patch | blob | history | |
src/rm_services.c | patch | blob | history | |
src/rm_tree.c | patch | blob | history |
diff --git a/include/rm_internal.h b/include/rm_internal.h
index 73eb7f8a8151812c56d1c3fbf22d164238eabec5..deba58db3d8e6729af9d8d61cda01d809b91d784 100644 (file)
--- a/include/rm_internal.h
+++ b/include/rm_internal.h
* Data structures used by more than one internal RM module.
*
* ============================================================================
- * (C) Copyright 2012-2013, Texas Instruments, Inc.
+ * (C) Copyright 2012-2014, Texas Instruments, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/package.xdc b/package.xdc
index 63dd3c05107c628cc6c92eb47711e2ac4c51c763..1a0c207af475d845f24c1a651298434c3b3d1b86 100755 (executable)
--- a/package.xdc
+++ b/package.xdc
* Copyright (C) 2012-2014, Texas Instruments, Inc.\r
*****************************************************************************/\r
\r
-package ti.drv.rm[02, 01, 00, 03] {\r
+package ti.drv.rm[02, 01, 00, 04] {\r
module Settings;\r
}\r
index 1b897a751f1f7d651ca6db1ebe657e15069dabec..988401f50d8a9a462b95044a5c9e1b42a5963b25 100644 (file)
--- a/rm.h
+++ b/rm.h
#define RM_ERROR_VALID_INST_NAME_TOO_LONG RM_ERROR_BASE-11
/** Instance name in permissions assignment is greater than RM_NAME_MAX_CHARS */
#define RM_ERROR_INST_NAME_IN_ASSIGNMENT_TOO_LONG RM_ERROR_BASE-12
-/** NameServer name in global resource list nameServer assignment is greater than RM_NAME_MAX_CHARS */
-#define RM_ERROR_GRL_NS_ASSIGNMENT_NAME_TOO_LONG RM_ERROR_BASE-13
+/** NameServer name in global resource list nameServer assignment and/or service request
+ * is greater than RM_NAME_MAX_CHARS */
+#define RM_ERROR_NAMESERVER_NAME_TOO_LONG RM_ERROR_BASE-13
/** Linux alias assignment in global resource list is invalid */
#define RM_ERROR_GRL_INVALID_LINUX_ALIAS_FORMAT RM_ERROR_BASE-14
/** Error allocating memory for the service handle */
/** The provided character buffer that will contain the service source inst name or pkt
* source inst name is not of size RM_NAME_MAX_CHARS */
#define RM_ERROR_SRC_NAME_BUF_INVALID_SIZE RM_ERROR_BASE-51
+/** A resource name specified in the GRL, policy, and/or service request is greater than
+ * RM_NAME_MAX_CHARS */
+#define RM_ERROR_RESOURCE_NAME_TOO_LONG RM_ERROR_BASE-52
/**
* @brief Maximum number of characters allowed for RM instance, resource, and
index f08f42a2d3fe792087af278fb756dff7ab565d7c..7106f9cc3c35d157273dc0b9e38c9033ab50fabd 100755 (executable)
--- a/rmver.h
+++ b/rmver.h
* @brief Resource Manager Version Definitions
*
* ============================================================
- * Copyright (c) Texas Instruments Incorporated 2012-2013
+ * Copyright (c) Texas Instruments Incorporated 2012-2014
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* format:
* 0xAABBCCDD -> Arch (AA); API Changes (BB); Major (CC); Minor (DD)
*/
-#define RM_VERSION_ID (0x02010003)
+#define RM_VERSION_ID (0x02010004)
/**
* @brief This is the version string which describes the RM along with the
* date and build information.
*/
-#define RM_VERSION_STR "RM Revision: 02.01.00.03"
+#define RM_VERSION_STR "RM Revision: 02.01.00.04"
#ifdef __cplusplus
diff --git a/rmver.h.xdt b/rmver.h.xdt
index 0e70fe889f3ecc4fb37351e17cd5e31219086e8c..8730a57d3734672a21e8ce88ac2b7df58cf70c5b 100644 (file)
--- a/rmver.h.xdt
+++ b/rmver.h.xdt
* @brief Resource Manager Version Definitions\r
*\r
* ============================================================\r
- * Copyright (c) Texas Instruments Incorporated 2012-2013\r
+ * Copyright (c) Texas Instruments Incorporated 2012-2014\r
* \r
* Redistribution and use in source and binary forms, with or without \r
* modification, are permitted provided that the following conditions \r
diff --git a/src/rm.c b/src/rm.c
index d58550f2bbf97611c980b53cc0c08ed1578579ff..de3cc4bcc6eec70897ff777561031f154bd187cc 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
*
* \par
* ============================================================================
- * @n (C) Copyright 2012-2013, Texas Instruments, Inc.
+ * @n (C) Copyright 2012-2014, Texas Instruments, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/src/rm_allocator.c b/src/rm_allocator.c
index d4cb1acd634c1c72c43da79ebe119d7afedfb68d..e0e4db6b808d3df319ea0248e696441db38297ab 100644 (file)
--- a/src/rm_allocator.c
+++ b/src/rm_allocator.c
*
* \par
* ============================================================================
- * @n (C) Copyright 2012-2013, Texas Instruments, Inc.
+ * @n (C) Copyright 2012-2014, Texas Instruments, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -510,6 +510,10 @@ static int32_t allocatorPreAllocate(Rm_Handle rmHandle, Rm_Allocator *allocator,
opInfo->resourceInfo->alignment = rmPolicyGetResourceAlignment(opInfo->policy, resourcePolicy);
}
+ if (opInfo->resourceInfo->alignment == 0) {
+ opInfo->resourceInfo->alignment = 1;
+ }
+
memset((void *)&findNode, 0, sizeof(findNode));
findNode.base = opInfo->resourceInfo->base;
findNode.length = opInfo->resourceInfo->length;
@@ -1328,6 +1332,11 @@ static int32_t allocatorExtractGrlResProps(Rm_Handle rmHandle, const char *resou
Rm_LinuxAlias *linuxAlias = NULL;
Rm_NameServerObjCfg nameServerObjCfg;
int32_t retVal = RM_OK;
+
+ if ((strlen(resourceName) + 1) > RM_NAME_MAX_CHARS) {
+ retVal = RM_ERROR_RESOURCE_NAME_TOO_LONG;
+ return(retVal);
+ }
if (resourceProperties->rangeData && (resourceProperties->rangeLen > 0)) {
range = rangeBasePtr = rmDtbUtilResExtractRange(resourceProperties->rangeData,
* node is one that is free and has no neighboring nodes
* or neighboring nodes that do not have resource values
* contiguous with the node being checked. The function
- * will return RM_TRUE is the node is localized.
+ * will return RM_TRUE if the node is localized.
* Otherwise, the function returns RM_FALSE
*/
int rmAllocatorGetNodeLocalization(Rm_Handle rmHandle, char *resourceName,
Rm_ResourceNode findNode;
Rm_ResourceNode *matchingNode = NULL;
Rm_ResourceNode *neighborNode = NULL;
- int nodeIsLocalized;
+ int nodeIsLocalized = RM_FALSE;
+
+ /* Nothing to free back to server if policy never specified blocks could be allocated
+ * to CD */
+ if (allocSize) {
+ memset((void *)&findNode, 0, sizeof(findNode));
+ findNode.base = *resBase;
+ findNode.length = *resLen;
+ matchingNode = RB_FIND(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, &findNode);
- memset((void *)&findNode, 0, sizeof(findNode));
- findNode.base = *resBase;
- findNode.length = *resLen;
- matchingNode = RB_FIND(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, &findNode);
+ if (matchingNode) {
+ /* Node can be freed back to Server from CD if:
+ * - allocationCount == 0
+ * - node's resource range is multiple of policy allocation size
+ * - node's resource range boundaries are not contiguous with surrounding nodes */
+ if (matchingNode->allocationCount) {
+ goto exitLocalization;
+ }
+
+ if (matchingNode->length % allocSize) {
+ goto exitLocalization;
+ }
- if (matchingNode) {
- /* Node can be freed back to Server from CD if:
- * - allocationCount == 0
- * - node's resource range is multiple of policy allocation size
- * - node's resource range boundaries are not contiguous with surrounding nodes */
- if (matchingNode->allocationCount) {
- nodeIsLocalized = RM_FALSE;
- goto exitLocalization;
- }
-
- if (matchingNode->length % allocSize) {
- nodeIsLocalized = RM_FALSE;
- goto exitLocalization;
- }
+ /* Check left neighbor */
+ neighborNode = RB_PREV(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, matchingNode);
+ if (neighborNode && allocatorResNodeBoundaryCompare(neighborNode, matchingNode)) {
+ goto exitLocalization;
+ }
- /* Check left neighbor */
- neighborNode = RB_PREV(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, matchingNode);
- if (neighborNode && allocatorResNodeBoundaryCompare(neighborNode, matchingNode)) {
- nodeIsLocalized = RM_FALSE;
- goto exitLocalization;
- }
+ /* Check right neighbor */
+ neighborNode = RB_NEXT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, matchingNode);
+ if (neighborNode && allocatorResNodeBoundaryCompare(neighborNode, matchingNode)) {
+ goto exitLocalization;
+ }
- /* Check right neighbor */
- neighborNode = RB_NEXT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, matchingNode);
- if (neighborNode && allocatorResNodeBoundaryCompare(neighborNode, matchingNode)) {
+ /* All localization checks passed. Return the base and length of localized node. */
+ nodeIsLocalized = RM_TRUE;
+ *resBase = matchingNode->base;
+ *resLen = matchingNode->length;
+ }
+ else {
nodeIsLocalized = RM_FALSE;
- goto exitLocalization;
}
-
- /* All localization checks passed. Return the base and length of localized node. */
- nodeIsLocalized = RM_TRUE;
- *resBase = matchingNode->base;
- *resLen = matchingNode->length;
- }
- else {
- nodeIsLocalized = RM_FALSE;
}
exitLocalization:
diff --git a/src/rm_dtb_util.c b/src/rm_dtb_util.c
index 92b4e6ac01d47f6969b7b25456b9bb8f9fb1596c..990bbfb33a7c65345abab76193e93f6f6702068c 100644 (file)
--- a/src/rm_dtb_util.c
+++ b/src/rm_dtb_util.c
*
* \par
* ============================================================================
- * @n (C) Copyright 2012-2013, Texas Instruments, Inc.
+ * @n (C) Copyright 2012-2014, Texas Instruments, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -412,7 +412,7 @@ Rm_NsAssignment *rmDtbUtilResExtractNsAssignment(const void *dtbDataPtr, int32_t
Rm_osalFree((void *)startAssignment, sizeof(Rm_NsAssignment));
startAssignment = newAssignment;
}
- *result = RM_ERROR_GRL_NS_ASSIGNMENT_NAME_TOO_LONG;
+ *result = RM_ERROR_NAMESERVER_NAME_TOO_LONG;
return(NULL);
}
rm_strncpy(newAssignment->nsName, ((char *) &dtbNsAssignmentData[i]), RM_NAME_MAX_CHARS);
diff --git a/src/rm_nameserver.c b/src/rm_nameserver.c
index 411db89886827d460bb9f084145207a7edf429c6..5fc9d9d7b39402ce17457a2f01894901b40d632c 100644 (file)
--- a/src/rm_nameserver.c
+++ b/src/rm_nameserver.c
*
* \par
* ============================================================================
- * @n (C) Copyright 2012-2013, Texas Instruments, Inc.
+ * @n (C) Copyright 2012-2014, Texas Instruments, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/src/rm_policy.c b/src/rm_policy.c
index 19df033fb98808fe269d8b0eea5903472aad484e..441cd912020832a94ab795d5bf5e4ac1a20b26c8 100644 (file)
--- a/src/rm_policy.c
+++ b/src/rm_policy.c
*
* \par
* ============================================================================
- * @n (C) Copyright 2012-2013, Texas Instruments, Inc.
+ * @n (C) Copyright 2012-2014, Texas Instruments, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -788,10 +788,6 @@ uint32_t rmPolicyGetResourceCdAllocSize(void *policyDtb, int32_t resourceOffset)
propertyOffset = fdt_next_property_offset(policyDtb, propertyOffset);
}
}
-
- if (resourceAllocSize == 0) {
- resourceAllocSize = 1;
- }
return(resourceAllocSize);
}
int32_t nodeOffset;
int32_t propertyOffset;
int32_t depth;
+ const char *resourceName;
const char *propertyName;
int32_t propertyLen;
const void *propertyData;
if (depth < RM_DTB_UTIL_STARTING_DEPTH) {
break;
}
+
+ resourceName = fdt_get_name(policyDtb, nodeOffset, NULL);
+ if ((strlen(resourceName) + 1) > RM_NAME_MAX_CHARS) {
+ return(RM_ERROR_RESOURCE_NAME_TOO_LONG);
+ }
+
propertyOffset = fdt_first_property_offset(policyDtb, nodeOffset);
while (propertyOffset > RM_DTB_UTIL_STARTING_NODE_OFFSET) {
propertyData = fdt_getprop_by_offset(policyDtb, propertyOffset, &propertyName, &propertyLen);
diff --git a/src/rm_services.c b/src/rm_services.c
index 80585ddfe30dbd40671fd989d8480b54cb6f27bd..bccd886ad5379b69d9db666c11b550ee3ce4934b 100644 (file)
--- a/src/rm_services.c
+++ b/src/rm_services.c
*
* \par
* ============================================================================
- * @n (C) Copyright 2012-2013, Texas Instruments, Inc.
+ * @n (C) Copyright 2012-2014, Texas Instruments, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -108,6 +108,20 @@ void Rm_serviceHandler (void *rmHandle, const Rm_ServiceReqInfo *serviceRequest,
return;
}
+ if (serviceRequest->resourceName) {
+ if ((strlen(serviceRequest->resourceName) + 1) > RM_NAME_MAX_CHARS) {
+ serviceResponse->serviceState = RM_ERROR_RESOURCE_NAME_TOO_LONG;
+ return;
+ }
+ }
+
+ if (serviceRequest->resourceNsName) {
+ if ((strlen(serviceRequest->resourceNsName) + 1) > RM_NAME_MAX_CHARS) {
+ serviceResponse->serviceState = RM_ERROR_NAMESERVER_NAME_TOO_LONG;
+ return;
+ }
+ }
+
/* Copy location of instance name to local variable in case Shared Client needs to
* transfer control to a shared server */
instanceName = rmInst->instName;
diff --git a/src/rm_tree.c b/src/rm_tree.c
index cdcb88e7b586e888a7ee5c02b3b91039b5e19206..8b2ab4de03148922aa4ce2f786511ab094b21630 100644 (file)
--- a/src/rm_tree.c
+++ b/src/rm_tree.c
*
* \par
* ============================================================================
- * @n (C) Copyright 2012-2013, Texas Instruments, Inc.
+ * @n (C) Copyright 2012-2014, Texas Instruments, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions