Skip to content
  • Daniel P. Berrangé's avatar
    e1d0b372
    hw/vfio/ccw: avoid taking address members in packed structs · e1d0b372
    Daniel P. Berrangé authored
    
    
    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/vfio/ccw.c: In function ‘vfio_ccw_io_notifier_handler’:
    hw/vfio/ccw.c:133:15: warning: taking address of packed member of ‘struct SCHIB’ may result in an unaligned pointer value \
    [-Waddress-of-packed-member]
      133 |     SCSW *s = &sch->curr_status.scsw;
          |               ^~~~~~~~~~~~~~~~~~~~~~
    hw/vfio/ccw.c:134:15: warning: taking address of packed member of ‘struct SCHIB’ may result in an unaligned pointer value \
    [-Waddress-of-packed-member]
      134 |     PMCW *p = &sch->curr_status.pmcw;
          |               ^~~~~~~~~~~~~~~~~~~~~~
    
    ...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: default avatarDaniel P. Berrangé <berrange@redhat.com>
    Message-Id: <20190329111104.17223-12-berrange@redhat.com>
    Reviewed-by: default avatarEric Farman <farman@linux.ibm.com>
    Reviewed-by: default avatarHalil Pasic <pasic@linux.ibm.com>
    Reviewed-by: default avatarFarhan Ali <alifm@linux.ibm.com>
    Signed-off-by: default avatarCornelia Huck <cohuck@redhat.com>
    e1d0b372
    hw/vfio/ccw: avoid taking address members in packed structs
    Daniel P. Berrangé authored
    
    
    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/vfio/ccw.c: In function ‘vfio_ccw_io_notifier_handler’:
    hw/vfio/ccw.c:133:15: warning: taking address of packed member of ‘struct SCHIB’ may result in an unaligned pointer value \
    [-Waddress-of-packed-member]
      133 |     SCSW *s = &sch->curr_status.scsw;
          |               ^~~~~~~~~~~~~~~~~~~~~~
    hw/vfio/ccw.c:134:15: warning: taking address of packed member of ‘struct SCHIB’ may result in an unaligned pointer value \
    [-Waddress-of-packed-member]
      134 |     PMCW *p = &sch->curr_status.pmcw;
          |               ^~~~~~~~~~~~~~~~~~~~~~
    
    ...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: default avatarDaniel P. Berrangé <berrange@redhat.com>
    Message-Id: <20190329111104.17223-12-berrange@redhat.com>
    Reviewed-by: default avatarEric Farman <farman@linux.ibm.com>
    Reviewed-by: default avatarHalil Pasic <pasic@linux.ibm.com>
    Reviewed-by: default avatarFarhan Ali <alifm@linux.ibm.com>
    Signed-off-by: default avatarCornelia Huck <cohuck@redhat.com>
Loading