qemu-s390x
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [qemu-s390x] [PATCH 12/14] hw/s390/css: avoid taking address members


From: Thomas Huth
Subject: Re: [qemu-s390x] [PATCH 12/14] hw/s390/css: avoid taking address members in packed structs
Date: Fri, 29 Mar 2019 16:26:11 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0

On 29/03/2019 12.11, Daniel P. Berrangé wrote:
> The GCC 9 compiler complains about many places in s390 code
> that take the address of members of the 'struct SCHIB' which
> is marked packed:
> 
> hw/s390x/css.c: In function ‘sch_handle_clear_func’:
> hw/s390x/css.c:698:15: warning: taking address of packed member of ‘struct 
> SCHIB’ may result in an unaligned pointer val\
> ue [-Waddress-of-packed-member]
>   698 |     PMCW *p = &sch->curr_status.pmcw;
>       |               ^~~~~~~~~~~~~~~~~~~~~~
> hw/s390x/css.c:699:15: warning: taking address of packed member of ‘struct 
> SCHIB’ may result in an unaligned pointer val\
> ue [-Waddress-of-packed-member]
>   699 |     SCSW *s = &sch->curr_status.scsw;
>       |               ^~~~~~~~~~~~~~~~~~~~~~
> 
> ...snip many more...
> 
> Almost all of these are just done for convenience to avoid
> typing out long variable/field names when referencing struct
> members. We can get most of this convenience by taking the
> address of the 'struct SCHIB' instead, avoiding triggering
> the compiler warnings.
> 
> In a couple of places we copy via a local variable which is
> a technique already applied elsewhere in s390 code for this
> problem.
> 
> Signed-off-by: Daniel P. Berrangé <address@hidden>

Patch looks fine to me.

Reviewed-by: Thomas Huth <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]