From 534eba66ce4a5bda45d5edeeb81ac5a3cf6d0df8 Mon Sep 17 00:00:00 2001 From: Ming Yue Date: Thu, 25 Mar 2021 15:57:42 -0700 Subject: [PATCH 1/2] Check NULL pointer input for vEventGroupDelete. (#293) * Check NULL pointer input for vEventGroupDelete. * Change the input parameter check with assertion. Co-authored-by: Cobus van Eeden <35851496+cobusve@users.noreply.github.com> --- event_groups.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/event_groups.c b/event_groups.c index 0ee799067..4a12430c1 100644 --- a/event_groups.c +++ b/event_groups.c @@ -625,6 +625,8 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, void vEventGroupDelete( EventGroupHandle_t xEventGroup ) { + configASSERT( xEventGroup ); + EventGroup_t * pxEventBits = xEventGroup; const List_t * pxTasksWaitingForBits = &( pxEventBits->xTasksWaitingForBits ); From b08c19f74560dc8885eaf04c47483817d28e13e2 Mon Sep 17 00:00:00 2001 From: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Date: Fri, 2 Apr 2021 07:35:52 -0700 Subject: [PATCH 2/2] Define default values of macros before first use (#298) configSTACK_ALLOCATION_FROM_SEPARATE_HEAP was added recently in https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/267. This macro was used in portable.h before its default value was defined, resulting in a warning when built with -Wundef. This changes moves the default value definition for configSTACK_ALLOCATION_FROM_SEPARATE_HEAP to portable.h to ensure that it is defined before first use. portUSING_MPU_WRAPPERS check in mpu_wrappers.h was updated in https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/285. The new check results in a warning when built with -Wundef because portUSING_MPU_WRAPPERS is not defined yet. This changes adds the default value definition for portUSING_MPU_WRAPPERS to portable.h to ensure that it is defined before first use. Signed-off-by: Gaurav Aggarwal --- include/FreeRTOS.h | 5 ----- include/mpu_wrappers.h | 1 - include/portable.h | 9 +++++++++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/FreeRTOS.h b/include/FreeRTOS.h index 6c3e82646..87c67d736 100644 --- a/include/FreeRTOS.h +++ b/include/FreeRTOS.h @@ -896,11 +896,6 @@ #define configSUPPORT_DYNAMIC_ALLOCATION 1 #endif -#ifndef configSTACK_ALLOCATION_FROM_SEPARATE_HEAP - /* Defaults to 0 for backward compatibility. */ - #define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0 -#endif - #ifndef configSTACK_DEPTH_TYPE /* Defaults to uint16_t for backward compatibility, but can be overridden diff --git a/include/mpu_wrappers.h b/include/mpu_wrappers.h index 6550c1e6a..841b51a54 100644 --- a/include/mpu_wrappers.h +++ b/include/mpu_wrappers.h @@ -177,7 +177,6 @@ #define PRIVILEGED_FUNCTION #define PRIVILEGED_DATA #define FREERTOS_SYSTEM_CALL - #define portUSING_MPU_WRAPPERS 0 #endif /* portUSING_MPU_WRAPPERS */ diff --git a/include/portable.h b/include/portable.h index f836747f8..3768e2cd8 100644 --- a/include/portable.h +++ b/include/portable.h @@ -79,6 +79,10 @@ #error "Invalid portBYTE_ALIGNMENT definition" #endif +#ifndef portUSING_MPU_WRAPPERS + #define portUSING_MPU_WRAPPERS 0 +#endif + #ifndef portNUM_CONFIGURABLE_REGIONS #define portNUM_CONFIGURABLE_REGIONS 1 #endif @@ -91,6 +95,11 @@ #define portARCH_NAME NULL #endif +#ifndef configSTACK_ALLOCATION_FROM_SEPARATE_HEAP + /* Defaults to 0 for backward compatibility. */ + #define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0 +#endif + /* *INDENT-OFF* */ #ifdef __cplusplus extern "C" {