summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiejunZhou <[email protected]>2023-10-23 14:33:24 +0800
committerGitHub <[email protected]>2023-10-23 14:33:24 +0800
commit9ee2738aec92ecab0dd321dd5836f56927f72b7a (patch)
treeb7535951938eb5d0aa689655c405f9808470f7df
parentbc4bd804d5a88d702690f585300d996a0bdff9b1 (diff)
Improved the logic to validate object from application in ThreadX Module (#307)
-rw-r--r--common_modules/module_manager/inc/txm_module_manager_util.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/common_modules/module_manager/inc/txm_module_manager_util.h b/common_modules/module_manager/inc/txm_module_manager_util.h
index b07868a2..db681ba9 100644
--- a/common_modules/module_manager/inc/txm_module_manager_util.h
+++ b/common_modules/module_manager/inc/txm_module_manager_util.h
@@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* txm_module_manager_util.h PORTABLE C */
-/* 6.1.6 */
+/* 6.x */
/* AUTHOR */
/* */
/* Scott Larson, Microsoft Corporation */
@@ -44,6 +44,9 @@
/* 04-02-2021 Scott Larson Modified comment(s) and */
/* optimized object checks, */
/* resulting in version 6.1.6 */
+/* xx-xx-xxxx Tiejun Zhou Modified comment(s) and */
+/* improved object check, */
+/* resulting in version 6.x */
/* */
/**************************************************************************/
@@ -100,13 +103,15 @@
/* Kernel objects should be outside the module at the very least. */
#define TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_USE(module_instance, obj_ptr, obj_size) \
- ((TXM_MODULE_MANAGER_ENSURE_OUTSIDE_MODULE(module_instance, obj_ptr, obj_size)) || \
+ (TXM_MODULE_MANAGER_ENSURE_OUTSIDE_MODULE(module_instance, obj_ptr, obj_size) || \
+ (_txm_module_manager_created_object_check(module_instance, (void *)obj_ptr) == TX_FALSE) || \
((void *) (obj_ptr) == TX_NULL))
/* When creating an object, the object must be inside the object pool. */
#define TXM_MODULE_MANAGER_PARAM_CHECK_OBJECT_FOR_CREATION(module_instance, obj_ptr, obj_size) \
((TXM_MODULE_MANAGER_ENSURE_INSIDE_OBJ_POOL(module_instance, obj_ptr, obj_size) && \
(_txm_module_manager_object_size_check(obj_ptr, obj_size) == TX_SUCCESS)) || \
+ (_txm_module_manager_created_object_check(module_instance, (void *)obj_ptr) == TX_FALSE) || \
((void *) (obj_ptr) == TX_NULL))
/* Strings we dereference can be in RW/RO/Shared areas. */