qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] e1d0b3: hw/vfio/ccw: avoid taking address mem


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] e1d0b3: hw/vfio/ccw: avoid taking address members in packe...
Date: Wed, 03 Apr 2019 15:07:16 +0000 (UTC)

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: e1d0b37261e6b7db18ebef6f1815489309312906
      
https://github.com/qemu/qemu/commit/e1d0b37261e6b7db18ebef6f1815489309312906
  Author: Daniel P. Berrangé <address@hidden>
  Date:   2019-04-03 (Wed, 03 Apr 2019)

  Changed paths:
    M hw/vfio/ccw.c

  Log Message:
  -----------
  hw/vfio/ccw: avoid taking address members in packed structs

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: Daniel P. Berrangé <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Farman <address@hidden>
Reviewed-by: Halil Pasic <address@hidden>
Reviewed-by: Farhan Ali <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>


  Commit: bea0279b72fcd7bf5b5305fabf3a3cbee3a3eaa6
      
https://github.com/qemu/qemu/commit/bea0279b72fcd7bf5b5305fabf3a3cbee3a3eaa6
  Author: Daniel P. Berrangé <address@hidden>
  Date:   2019-04-03 (Wed, 03 Apr 2019)

  Changed paths:
    M hw/s390x/css.c

  Log Message:
  -----------
  hw/s390/css: avoid taking address members in packed structs

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>
Message-Id: <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
Reviewed-by: Halil Pasic <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>


  Commit: 5d45a332920d6dd5536ba5f886713f5a213f90bb
      
https://github.com/qemu/qemu/commit/5d45a332920d6dd5536ba5f886713f5a213f90bb
  Author: Daniel P. Berrangé <address@hidden>
  Date:   2019-04-03 (Wed, 03 Apr 2019)

  Changed paths:
    M hw/s390x/ipl.c

  Log Message:
  -----------
  hw/s390x/ipl: avoid taking address of fields in packed struct

Compiling with GCC 9 complains

hw/s390x/ipl.c: In function ‘s390_ipl_set_boot_menu’:
hw/s390x/ipl.c:256:25: warning: taking address of packed member of ‘struct 
QemuIplParameters’ may result in an unaligned pointer value 
[-Waddress-of-packed-member]
  256 |     uint32_t *timeout = &ipl->qipl.boot_menu_timeout;
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

This local variable is only present to save a little bit of
typing when setting the field later. Get rid of this to avoid
the warning about unaligned accesses.

Signed-off-by: Daniel P. Berrangé <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: David Hildenbrand <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
Reviewed-by: Farhan Ali <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>


  Commit: 7357b2215978debf2fd17b525ba745d3c69272a3
      
https://github.com/qemu/qemu/commit/7357b2215978debf2fd17b525ba745d3c69272a3
  Author: Daniel P. Berrangé <address@hidden>
  Date:   2019-04-03 (Wed, 03 Apr 2019)

  Changed paths:
    M hw/s390x/3270-ccw.c

  Log Message:
  -----------
  hw/s390x/3270-ccw: avoid taking address of fields in packed struct

Compiling with GCC 9 complains

hw/s390x/3270-ccw.c: In function ‘emulated_ccw_3270_cb’:
hw/s390x/3270-ccw.c:81:19: error: taking address of packed member of ‘struct 
SCHIB’ may result in an unaligned pointer value 
[-Werror=address-of-packed-member]
   81 |         SCSW *s = &sch->curr_status.scsw;
      |                   ^~~~~~~~~~~~~~~~~~~~~~

This local variable is only present to save a little bit of
typing when setting the field later. Get rid of this to avoid
the warning about unaligned accesses.

Signed-off-by: Daniel P. Berrangé <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: David Hildenbrand <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>


  Commit: f4b37171378b0b1782570060c3411a504375d1bc
      
https://github.com/qemu/qemu/commit/f4b37171378b0b1782570060c3411a504375d1bc
  Author: Peter Maydell <address@hidden>
  Date:   2019-04-03 (Wed, 03 Apr 2019)

  Changed paths:
    M hw/s390x/3270-ccw.c
    M hw/s390x/css.c
    M hw/s390x/ipl.c
    M hw/vfio/ccw.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20190403' into staging

Fix taking address of fields in packed structs warnings
by gcc 9

# gpg: Signature made Wed 03 Apr 2019 10:58:42 BST
# gpg:                using RSA key C3D0D66DC3624FF6A8C018CEDECF6B93C6F02FAF
# gpg:                issuer "address@hidden"
# gpg: Good signature from "Cornelia Huck <address@hidden>" [unknown]
# gpg:                 aka "Cornelia Huck <address@hidden>" [full]
# gpg:                 aka "Cornelia Huck <address@hidden>" [full]
# gpg:                 aka "Cornelia Huck <address@hidden>" [unknown]
# gpg:                 aka "Cornelia Huck <address@hidden>" [unknown]
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/s390x-20190403:
  hw/s390x/3270-ccw: avoid taking address of fields in packed struct
  hw/s390x/ipl: avoid taking address of fields in packed struct
  hw/s390/css: avoid taking address members in packed structs
  hw/vfio/ccw: avoid taking address members in packed structs

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/061b51e91956...f4b37171378b



reply via email to

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