Summary: | libpulsecommon.so unaligned memory access issue | ||
---|---|---|---|
Product: | PulseAudio | Reporter: | Yupeng Chang <changyp6> |
Component: | core | Assignee: | pulseaudio-bugs |
Status: | RESOLVED MOVED | QA Contact: | pulseaudio-bugs |
Severity: | major | ||
Priority: | high | CC: | changyp6, lennart |
Version: | unspecified | Keywords: | love |
Hardware: | ARM | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
Yupeng Chang
2013-06-06 18:31:53 UTC
Right, I can see where we need to fix these unaligned reads reads (the hashmap has an array of hashmap_entry just allocated at after the structure using malloc. which us just awful). Patches welcome, and attaching a 'love' keyword since it shouldn't be terribly complicated to fix this. Hi Arun, The simplest way to fix this is to add another structure struct hasmap_table { struct pa_hashmap hashmap; struct hashmap_entry* entry[NBUCKETS]; }; change #define BY_HASH(h) ((struct hashmap_entry**) ((uint8_t*) (h) + PA_ALIGN(sizeof(pa_hashmap)))) to #define BY_HASH(h) (((struct hashmap_table*)h)->entry) Then, change h = pa_xmalloc0(PA_ALIGN(sizeof(pa_hashmap)) + NBUCKETS*sizeof(struct hashmap_entry*)); to h = pa_xmalloc0(sizeof(struct hashmap_table)); I found there are lots of files in pulseaudio have cast-align issue. I did this modification and compiled, no warnings anymore. But I have test if this modification is OK. If you think this modification is OK, please help test.. Thanks you! Sorry, I haven't tested if this modification is OK or not. is the proposed change supposed to fix the compiler warnings or the unaligned memory access? the current code is using PA_ALIGN(), so the entries should start on an aligned address -- the memory layout won't be affected I think? -- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/241. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.