Fix ABF NODE_MEMREQ instance header underallocation - #94
Closed
goyalpalak18 wants to merge 1 commit into
Closed
Conversation
Signed-off-by: goyalpalak18 <goyalpalak1806@gmail.com>
Author
|
@llefaucheur @joseph-yiu I put together a fix for the memory allocation issue in ee_abf_f32.c. Ready for review when you have a moment |
Contributor
|
Its good for me. I did not checked but I see no reason the Audiomark score to being changed with this patch. |
Author
|
Thanks @llefaucheur . I can confirm the scores will stay exactly the same. Let me know if you need anything else before merging! |
Contributor
|
Hi @goyalpalak18 , @llefaucheur , |
Contributor
|
Merged into dev branch (dev_2026q1). Thanks for the patch. |
Contributor
|
Closing this pull request as the AudioMark v1.0.4 release is completed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
I tracked down a nasty bug causing HardFaults on our ARM and RISC-V targets. We had a memory calculation mismatch in
ee_abf_f32.cthat was silently eating our CMSIS-DSP safety padding. It was invisible on standard x86 builds, but broke on target hardware with strict memory protection (MPU/PMP) enabled.Root Cause
In the
NODE_MEMREQcalculation, we were only budgeting for two pointers. However,beamformer_f32_reset()actually uses all four pointers defined in theabf_f32_instance_tstruct.Because we shortchanged the allocation by 8 to 16 bytes, the instance header spilled over and consumed the 12-byte CMSIS-DSP safety padding at the end of the buffer. When vectorized operations (like Helium or NEON) did their normal read-past-end tail processing, they hit unmapped memory and triggered immediate HardFaults.
The Fix
I replaced the hardcoded pointer math with
sizeof(abf_f32_instance_t). This correctly accounts for the entire struct, is self-documenting, and prevents the header from overwriting the safety padding.Impact