Skip to content

Conversation

@chinglee-iot
Copy link
Member

@chinglee-iot chinglee-iot commented Sep 2, 2023

Update block validate macro in heap_5

Description

When configENABLE_HEAP_PROTECTOR is not set in heap_5, pucHeapHighAddress and pucHeapLowAddress won't be updated.
The following assert is always triggered.

    #define heapVALIDATE_BLOCK_POINTER( pxBlock )                       \
    configASSERT( ( pucHeapHighAddress != NULL ) &&                     \
                  ( pucHeapLowAddress != NULL ) &&                      \
                  ( ( uint8_t * ) ( pxBlock ) >= pucHeapLowAddress ) && \
                  ( ( uint8_t * ) ( pxBlock ) < pucHeapHighAddress ) )

This PR upate the heapVALIDATE_BLOCK_POINTER macro when configENABLE_HEAP_PROTECTOR is not set to 1.

Test Steps

Run the WIN32-MSVC demo
Before this pull request

Trace started.
The trace will be dumped to the file "Trace.dump" whenever a call to configASSERT()
fails or the 't' key is pressed.
Note that the trace output uses the ring buffer mode, meaning that the output trace
will only be the most recent data able to fit within the trace recorder buffer.

Starting the full demo.
ASSERT! Line 264, file C:\msys64\home\chinglee\kernel\heap_verify\FreeRTOS\FreeRTOS\S
ource\portable\MemMang\heap_5.c, GetLastError() 0

Trace output saved to Trace.dump

After this PR

Trace started.
The trace will be dumped to the file "Trace.dump" whenever a call to configASSERT()
fails or the 't' key is pressed.
Note that the trace output uses the ring buffer mode, meaning that the output trace
will only be the most recent data able to fit within the trace recorder buffer.

Starting the full demo.

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

* Not validate block pointer when configENABLE_HEAP_PROTECTOR is not set
  to 1
@chinglee-iot chinglee-iot requested a review from a team as a code owner September 2, 2023 04:01
@codecov
Copy link

codecov bot commented Sep 2, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (af2904b) 94.35% compared to head (60c39e1) 94.35%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #774   +/-   ##
=======================================
  Coverage   94.35%   94.35%           
=======================================
  Files           6        6           
  Lines        2446     2446           
  Branches      598      598           
=======================================
  Hits         2308     2308           
  Misses         85       85           
  Partials       53       53           
Flag Coverage Δ
unittests 94.35% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

tony-josi-aws
tony-josi-aws previously approved these changes Sep 2, 2023
sirnish
sirnish previously approved these changes Sep 2, 2023
@chinglee-iot chinglee-iot requested a review from Skptak September 2, 2023 05:54
@chinglee-iot chinglee-iot dismissed stale reviews from sirnish and tony-josi-aws via 60c39e1 September 2, 2023 06:10
@Skptak Skptak merged commit 80a390c into FreeRTOS:main Sep 3, 2023
@chinglee-iot chinglee-iot deleted the update-heap_5-validate-pointer branch September 4, 2023 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants