Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect implementation of pvPortMalloc by the heap_4.c of FreeRTOS #85

Closed
TheSilentDawn opened this issue Oct 20, 2020 · 1 comment
Closed
Assignees
Labels
mw Middleware-related issue or pull-request. rtos RTOS-related issue or pull-request third party Third party related issue. Out of the scope of STMicroelectronics. wontfix This will not be worked on

Comments

@TheSilentDawn
Copy link

Describe the set-up

  • Development board: STM32H7B3I-DK and STM32H7B3I-EVAL
  • IDE and version: STMCubeIDE 1.4.0

Describe the bug
The function pvPortMalloc() is used to allocate memory for the required size.
The parameter xWantedSize indicates the length of memory required. However, when the required memory block size is zero. The memory pointer variable pvReturn will keep as NULL. If the configuration configUSE_MALLOC_FAILED_HOOK is enabled, it will recognize the variable xWantedSize valued zero as an error and handle it with the function vApplicationMallocFailedHook() as shown in https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/5fb26de0194b4ebfd09b37128bf9f3ff6d34c1b7/portable/MemMang/heap_4.c#L253 (also

)

How To Reproduce

  1. Import the Domenstration example ClockAndWeather of the board STM32H7B3I-DK.

  2. Enable macro configUSE_MALLOC_FAILED_HOOK. This is default enabled when I try to debug the program.

  3. Run the firmware with a default configuration to reproduce and it will loop infinitely.

  4. This problem is caused by the incorrect implementation of the function pvPortMalloc() by heap_4.c of FreeRTOS. This bug is already reported to FreeRTOS as shown in [BUG] incorrect implementation of pvPortMalloc FreeRTOS/FreeRTOS-Kernel#204.

Additional context

To patch it, should return NULL or the next available heap address when the parameter xWantedSize is zero.

@RKOUSTM RKOUSTM self-assigned this Nov 3, 2020
@RKOUSTM RKOUSTM added the mw Middleware-related issue or pull-request. label Nov 3, 2020
@RKOUSTM RKOUSTM added the wontfix This will not be worked on label Nov 11, 2020
@RKOUSTM
Copy link
Contributor

RKOUSTM commented Nov 11, 2020

Hi @TheSilentDawn,

Thank you for this report. Unfortunately, for this point, we don't treat aspect related to FreeRTOS in our GitHub repositories. As the heap_4.c file is out of the scope of STMicroelectronics, any modifications concerning this file are not implemented by our technical team.

Please allow me to close this issue now. Thank you for your contribution.

With regards,

@RKOUSTM RKOUSTM closed this as completed Nov 16, 2020
stm32cube-mcu-fw-dashboard automation moved this from To do to Done Nov 16, 2020
@RKOUSTM RKOUSTM added the third party Third party related issue. Out of the scope of STMicroelectronics. label Dec 2, 2020
@ALABSTM ALABSTM added the rtos RTOS-related issue or pull-request label Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mw Middleware-related issue or pull-request. rtos RTOS-related issue or pull-request third party Third party related issue. Out of the scope of STMicroelectronics. wontfix This will not be worked on
Projects
Development

No branches or pull requests

3 participants