From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:56682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBcHd-0007p1-F2 for qemu-devel@nongnu.org; Wed, 03 Apr 2019 05:34:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBcHc-00006g-Af for qemu-devel@nongnu.org; Wed, 03 Apr 2019 05:34:13 -0400 Date: Wed, 3 Apr 2019 11:33:54 +0200 From: Cornelia Huck Message-ID: <20190403113354.0b9706c5.cohuck@redhat.com> In-Reply-To: <20190402161129.GL413@redhat.com> References: <20190329111104.17223-1-berrange@redhat.com> <20190329111104.17223-12-berrange@redhat.com> <20190402180033.77510387.cohuck@redhat.com> <20190402161129.GL413@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 11/14] hw/vfio/ccw: avoid taking address members in packed structs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. =?UTF-8?B?QmVycmFuZ8Op?=" Cc: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, Richard Henderson , Halil Pasic , David Hildenbrand , Max Filippov , Eric Farman , Farhan Ali , Gerd Hoffmann , Riku Voipio , Alex Williamson , Christian Borntraeger , Thomas Huth , Laurent Vivier On Tue, 2 Apr 2019 17:11:29 +0100 Daniel P. Berrang=C3=A9 wrote: > On Tue, Apr 02, 2019 at 06:00:33PM +0200, Cornelia Huck wrote: > > On Fri, 29 Mar 2019 11:11:01 +0000 > > Daniel P. Berrang=C3=A9 wrote: > > =20 > > > 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: > > >=20 > > > hw/vfio/ccw.c: In function =E2=80=98vfio_ccw_io_notifier_handler=E2= =80=99: > > > hw/vfio/ccw.c:133:15: warning: taking address of packed member of =E2= =80=98struct SCHIB=E2=80=99 may result in an unaligned pointer value \ > > > [-Waddress-of-packed-member] > > > 133 | SCSW *s =3D &sch->curr_status.scsw; > > > | ^~~~~~~~~~~~~~~~~~~~~~ > > > hw/vfio/ccw.c:134:15: warning: taking address of packed member of =E2= =80=98struct SCHIB=E2=80=99 may result in an unaligned pointer value \ > > > [-Waddress-of-packed-member] > > > 134 | PMCW *p =3D &sch->curr_status.pmcw; > > > | ^~~~~~~~~~~~~~~~~~~~~~ > > >=20 > > > ...snip many more... > > >=20 > > > 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. > > >=20 > > > In a couple of places we copy via a local variable which is > > > a technique already applied elsewhere in s390 code for this > > > problem. > > >=20 > > > Signed-off-by: Daniel P. Berrang=C3=A9 > > > --- > > > hw/vfio/ccw.c | 42 ++++++++++++++++++++++-------------------- > > > 1 file changed, 22 insertions(+), 20 deletions(-) =20 > >=20 > > I'm currently in the process of queuing this and the other three s390x > > fixes, but I'm inclined to do so for 4.1 (it feels a bit late in the > > cycle for 4.0.) > >=20 > > Other opinions? =20 >=20 > It would be nice to be warning free for 4.0, but I agree that it feels > kind of late to be making these changes. They're not fixing real world > bugs, and even if you queue the s390 bits we're unlikely to get all the > others merged, especially the usb-mtp one is a nasty mess. So we'll > not be 100% warning free. Yeah, but OTOH, the s390x changes are straightforward and have been reviewed by several people. So I changed my mind and queued them to s390-fixes :)