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

logging: sys_t/catalog: fix unaligned access #60604

Merged

Conversation

dcpleung
Copy link
Member

When copying parameters into payload buffer, it is possible that after copying a string over, the pointer to buffer is no longer aligned on 4 or 8 bytes. And some toolchains may decide to treat the copy as aligned since the values being copied are 4 or 8 bytes. This results in unaligned memory access and hardware exception. So change the copy to memcpy to avoid potential unaligned access.

When copying parameters into payload buffer, it is possible
that after copying a string over, the pointer to buffer is
no longer aligned on 4 or 8 bytes. And some toolchains may
decide to treat the copy as aligned since the values being
copied are 4 or 8 bytes. This results in unaligned memory
access and hardware exception. So change the copy to memcpy
to avoid potential unaligned access.

Signed-off-by: Daniel Leung <[email protected]>
@dcpleung dcpleung marked this pull request as ready for review July 20, 2023 15:30
@carlescufi carlescufi merged commit 287916c into zephyrproject-rtos:main Jul 25, 2023
19 checks passed
@dcpleung dcpleung deleted the logging/syst/misaligned_access branch July 25, 2023 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants