kernel: userspace: Fix address-of-packed-mem warning
The warning below appears once -Waddress-of-packed-mem is enabled: /home/carles/src/zephyr/zephyr/kernel/userspace.c: In function 'unref_check': /home/carles/src/zephyr/zephyr/kernel/userspace.c:471:28: warning: converting a packed 'struct z_object' pointer (alignment 4) to a 'struct dyn_obj' pointer (alignment 16) may result in an unaligned pointer value [-Waddress-of-packed-mem ber] 471 | CONTAINER_OF(ko, struct dyn_obj, kobj); To avoid the warning, use an intermediate void * variable. More info in #16587. Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
parent
2000cdf6dc
commit
55350a93e9
1 changed files with 5 additions and 2 deletions
|
@ -466,8 +466,11 @@ static void unref_check(struct z_object *ko, uintptr_t index)
|
|||
sys_bitfield_clear_bit((mem_addr_t)&ko->perms, index);
|
||||
|
||||
#ifdef CONFIG_DYNAMIC_OBJECTS
|
||||
struct dyn_obj *dyn =
|
||||
CONTAINER_OF(ko, struct dyn_obj, kobj);
|
||||
void *vko = ko;
|
||||
|
||||
struct dyn_obj *dyn = CONTAINER_OF(vko, struct dyn_obj, kobj);
|
||||
/* TODO: check why this assert hits */
|
||||
/*__ASSERT(IS_PTR_ALIGNED(dyn, struct dyn_obj), "unaligned z_object");*/
|
||||
|
||||
if ((ko->flags & K_OBJ_FLAG_ALLOC) == 0U) {
|
||||
goto out;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue