zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.88k stars 6.63k forks source link

USB Audio: Unaligned address data access #78920

Open LuoZhongYao opened 1 month ago

LuoZhongYao commented 1 month ago

https://github.com/zephyrproject-rtos/zephyr/blob/810f978bed4fbc35eec165eaaedd17745b1ec255/subsys/usb/device/class/audio/audio.c#L598 https://github.com/zephyrproject-rtos/zephyr/blob/810f978bed4fbc35eec165eaaedd17745b1ec255/subsys/usb/device/class/audio/audio.c#L580 https://github.com/zephyrproject-rtos/zephyr/blob/810f978bed4fbc35eec165eaaedd17745b1ec255/subsys/usb/device/class/audio/audio.c#L592

https://github.com/zephyrproject-rtos/zephyr/blob/810f978bed4fbc35eec165eaaedd17745b1ec255/samples/subsys/usb/audio/headphones_microphone/src/main.c#L56 https://github.com/zephyrproject-rtos/zephyr/blob/810f978bed4fbc35eec165eaaedd17745b1ec255/samples/subsys/usb/audio/headset/src/main.c#L54

int16_t access to unaligned memory, which will cause exceptions on some platforms, such as mips

henrikbrixandersen commented 1 month ago

Please use our bug template when reporting bugs. You need to edit this issue to include the information requested in https://github.com/zephyrproject-rtos/zephyr/blob/main/.github/ISSUE_TEMPLATE/001_bug_report.md

tmon-nordic commented 1 month ago

Would the solution be to change these accesses to UNALIGNED_PUT()/UNALIGNED_GET()? Can you submit the PR with the fix?