From nobody Sun Nov 9 23:06:56 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552118487484961.7273409153632; Sat, 9 Mar 2019 00:01:27 -0800 (PST) Received: from localhost ([127.0.0.1]:55435 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2Wv5-0005hL-F5 for importer@patchew.org; Sat, 09 Mar 2019 03:01:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2Wih-0003tB-5y for qemu-devel@nongnu.org; Sat, 09 Mar 2019 02:48:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h2Wig-0000Wo-DT for qemu-devel@nongnu.org; Sat, 09 Mar 2019 02:48:35 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:38723) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h2Wig-0000R1-3Y for qemu-devel@nongnu.org; Sat, 09 Mar 2019 02:48:34 -0500 Received: by mail-wr1-x442.google.com with SMTP id g12so23639139wrm.5 for ; Fri, 08 Mar 2019 23:48:29 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id 11sm5252294wmg.27.2019.03.08.23.48.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Mar 2019 23:48:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jeq1Z775uJWBwJh4Co74sW+KjrQOpq+rUqMR7K7W0yk=; b=TZjS7GrA95hWoaKp+aISkMCYLErMZmGx6OVfqsE6MlSuzxSnVfzs6JwBareu058uYD VGVGexfEZL/NVAx3281F6C6FC1E+Y8xKEWUyv6T9GCRXzyJPhUZ6mX0amnlQfwdPSvmc O603YMvhFxcNruoPfjQDoaGi9DckkmKJA91sht66i9oyHjMD+2GdegIP+syKYzfueDqW U7K51Z7KSFK5lsW9LI8O8xtrkJhCML7cVnHA6pyf9edE+pZLUdtLrEytZ222gdlG/Wfe KBYf5A1QqrlbgMUEohXXFfxJo4g9K3L3xvLL+hTg0eNBGEfitMBacHF0LcyH/8Bu0f4g +xng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=jeq1Z775uJWBwJh4Co74sW+KjrQOpq+rUqMR7K7W0yk=; b=uZM1DfYM+49jIvrZwFWAgyrVkhpCKL8TA/iT6rEVxO5KZrDDo9/LeRC7FMDfmiIcb9 hGjY0W5gbInFVZeLcHLbeMzj5klCnZXug4j39SHl05RYuPQagkNOhLCq1VfFUbilfGr9 9mlgvTPAbmYr1bVbYyuS0dY/astVvY2Akc5bLfghOESabMatfpS3jpFn4bNA6Q2ZISDU 20txXh+flSe/x/v7t38lSERM2R3a/xvIrgV/uOjsIWxCc/1LXeIdYBgluLlVWpNXWdZz paDilSdFXUYORwrelicQSMtddHm5ePlcTWp47rzf8IaCrk5YMWXLqT0NyRIOMwZoB/Aq TORw== X-Gm-Message-State: APjAAAUfeDgp85Njytn8/l+xotIAm0mim229XGfrkeIlZKylUn8EE0w1 AAfLwrfUwjDOkNdcDXMy+gW5eEQd X-Google-Smtp-Source: APXvYqx8ZjfNTd75wD1FjPZVu8+Txw7CdbnbDXix6Aat8gEi0+gEQapLQSj12ZdN+v5MHjAi+xQoYw== X-Received: by 2002:adf:edd1:: with SMTP id v17mr13748948wro.300.1552117707866; Fri, 08 Mar 2019 23:48:27 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Sat, 9 Mar 2019 08:48:02 +0100 Message-Id: <1552117698-12355-10-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1552117698-12355-1-git-send-email-pbonzini@redhat.com> References: <1552117698-12355-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PULL 09/25] virtio-scsi: Fix build with gcc 9 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Greg Kurz Build fails with gcc 9: CC ppc64-softmmu/hw/scsi/virtio-scsi.o hw/scsi/virtio-scsi.c: In function =C3=A2=E2=82=AC=CB=9Cvirtio_scsi_do_tmf= =C3=A2=E2=82=AC=E2=84=A2: hw/scsi/virtio-scsi.c:265:39: error: taking address of packed member of =C3= =A2=E2=82=AC=CB=9Cstruct virtio_scsi_ctrl_tmf_req=C3=A2=E2=82=AC=E2=84=A2 m= ay result in an unaligned pointer value [-Werror=3Daddress-of-packed-member] 265 | virtio_tswap32s(VIRTIO_DEVICE(s), &req->req.tmf.subtype); | ^~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors All the fields in struct virtio_scsi_ctrl_tmf_req are naturally aligned, so we could in theory drop QEMU_PACKED. Unfortunately, the header file is imported from linux which already has the packed attribute. Trying to fix that in the update-linux-headers.sh script is likely to produce ugliness. Turn the call to virtio_tswap32s() into an assignment instead. Signed-off-by: Greg Kurz Message-Id: <155137678223.44753.5438092367451176318.stgit@bahia.lan> Signed-off-by: Paolo Bonzini --- hw/scsi/virtio-scsi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index ce99d28..839f120 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -262,7 +262,13 @@ static int virtio_scsi_do_tmf(VirtIOSCSI *s, VirtIOSCS= IReq *req) /* Here VIRTIO_SCSI_S_OK means "FUNCTION COMPLETE". */ req->resp.tmf.response =3D VIRTIO_SCSI_S_OK; =20 - virtio_tswap32s(VIRTIO_DEVICE(s), &req->req.tmf.subtype); + /* + * req->req.tmf has the QEMU_PACKED attribute. Don't use virtio_tswap3= 2s() + * to avoid compiler errors. + */ + req->req.tmf.subtype =3D + virtio_tswap32(VIRTIO_DEVICE(s), req->req.tmf.subtype); + switch (req->req.tmf.subtype) { case VIRTIO_SCSI_T_TMF_ABORT_TASK: case VIRTIO_SCSI_T_TMF_QUERY_TASK: --=20 1.8.3.1