Skip to content

Conversation

@jsarha
Copy link
Contributor

@jsarha jsarha commented Oct 31, 2025

Relax virtual_heap_alloc() assert condition so that it allows zero alignment for the case where no particular alignment is requested.

Relax virtual_heap_alloc() assert condition so that it allows zero
alignment for the case where no particular alignment is requested.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
@jsarha jsarha requested a review from dabekjakub as a code owner October 31, 2025 10:20
Copilot AI review requested due to automatic review settings October 31, 2025 10:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR relaxes the assertion condition in the virtual_heap_alloc() function to allow zero alignment values, which represents cases where no specific alignment is requested.

  • Modified the assert condition to permit zero alignment as a valid case
  • Maintains existing alignment validation for non-zero alignment values

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return NULL;

assert(IS_ALIGNED(mem, align));
assert(align == 0 || IS_ALIGNED(mem, align));
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition align == 0 may be misleading since zero is not a valid alignment value for memory operations. Consider checking if align is a power of 2 when non-zero, or document that zero specifically means 'no alignment requirement' to clarify the API contract.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll proceed as I don't think is worth the back-and-forth we already had in #10324 . If there are updated, I'd add a note about this alignment==0 zero treatmeant, as I still think this is not standard practise (e.g. C++/C compilers will give you an error if you pass a zero alignment attribute).

@kv2019i kv2019i merged commit 9c267bb into thesofproject:main Oct 31, 2025
35 of 42 checks passed
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.

4 participants