From nobody Mon Feb 9 14:02:48 2026 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 1552324819896233.52538473128334; Mon, 11 Mar 2019 10:20:19 -0700 (PDT) Received: from localhost ([127.0.0.1]:37147 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3Ob1-00025B-Ny for importer@patchew.org; Mon, 11 Mar 2019 13:20:15 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3ODW-000729-BC for qemu-devel@nongnu.org; Mon, 11 Mar 2019 12:55:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3ODU-00031M-5E for qemu-devel@nongnu.org; Mon, 11 Mar 2019 12:55:57 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:40521) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3ODS-0002wu-Bj for qemu-devel@nongnu.org; Mon, 11 Mar 2019 12:55:54 -0400 Received: by mail-wm1-x343.google.com with SMTP id g20so5006739wmh.5 for ; Mon, 11 Mar 2019 09:55:52 -0700 (PDT) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id e12sm6484836wrs.91.2019.03.11.09.55.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2019 09:55:50 -0700 (PDT) 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=rnfmF2jVZQefXTMs2tLRfMQiUchQO8opf7HUWxgamgp7pl1l/msO4YdEl2oeqOc4RV q8Vv7yOiO00/SohRPgNQHFO4j3Lwekfi6LFgI3isava8ums2nuLkoxQUHXV4gz8BdyiL TZ+PDO0zYCL4i+2wYTywe7T63omR67WCF3+XuBky0uY1YcsB66Z/PASlBRYd4ZUUL4Z0 2GqeyT10m63rKAgTL8JoY1I9Jwjvfgqw8Z+Z2U7WbrNRrA3FJ+HbXhqzyBPHkl3jh23a 03FkZr+3rRu2XAoMS8Ex6zmkf2dkGijBIpXLNCc2KvrpWCqduFRQQqxUHsri4QCm5szu CmHg== 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=EUbMD/MxuQjMeMJtZAc1uqZVzLCQBlNMQ77iHhYB2UTVWeb5U2zQ+/sDxq/AwiBUHF i68tFX9sv2R2xZFOwM9MhOoaHmnSQFaYRLy4abRyiwzBMNR8y5g/0wGXqi1lyfb9285J 3uw9NsTM+7yO/jkNzDZXESy7l4kRDwClsViUcFJd+ZtdqGhafcQV+OxkhF5fl9cg3/IZ vJPnrhSEHoqyzlyG94CbmX/KqrLpog51alQPRkxf3U2v01MwLE6t/++CqJ9d2xJQvu56 d6iS4Fg27ZmrXjmgNbIXczkSg2clqvuxfqdLaV1B1du5zSRGKhQgDL3rc8GTQvqpY+up P5zg== X-Gm-Message-State: APjAAAWqhCU/d5hzq1jMn9xBdyVj11lP6hYhQr+tE2MYdiXDlOTyATaQ xywuRcStiF6OL6KlJzO9CNrpYeUU X-Google-Smtp-Source: APXvYqyuSwVOznzy0aosjmfyGFRwtfxSD7S2Zy0xRVYSRXYCwDQgsOIiOGcvPNxlJMsWKjzC36xVVw== X-Received: by 2002:a7b:c348:: with SMTP id l8mr409039wmj.135.1552323350778; Mon, 11 Mar 2019 09:55:50 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 11 Mar 2019 17:55:15 +0100 Message-Id: <1552323335-46779-12-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1552323335-46779-1-git-send-email-pbonzini@redhat.com> References: <1552323335-46779-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::343 Subject: [Qemu-devel] [PULL v2 11/31] 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