From nobody Mon Feb 9 11:46:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1635870420; cv=none; d=zohomail.com; s=zohoarc; b=GRiB0QPs5w/PtObBlezV2T6I611BCaN2vIDevuDxlOaVYKeYCtxHG9gHoPXBCb9gPjnVhun0zPffXu0FfJcEJM+JVQaRcCzY31wJkBssBrsXMcNYfYcFk9s6aMqx0uHGw4JJv8DMxsILnUcotaqwhsMaaAV0PSGYw9qgikPuAg8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635870420; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ss/Hz3Amunh7qd04Lf0rLRk/NM7TeE6BsChzCFgfXdg=; b=DMf53VF/cxr9aRPTgsF+w2EuJDXohxqTTeCKYRhWtqf3waSGjNJbb0m+J4i0mN2xcSPPqbTGzKINoItFw7MYzGuDf+SgqWXKbpUFzYcwAZiyPAoGbXMPP96fAA0iv/DCDaFjcwqHlBC95QXghSBELYcjzvYfnMqsePHSUwF9jJU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 163587042030338.14988095956244; Tue, 2 Nov 2021 09:27:00 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-101-jV2poLgqNL2h2Z2NeSMbNg-1; Tue, 02 Nov 2021 12:26:55 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1319418125D0; Tue, 2 Nov 2021 16:26:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DD0952271F; Tue, 2 Nov 2021 16:26:48 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A3ECE4EA39; Tue, 2 Nov 2021 16:26:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1A2GQdHh005471 for ; Tue, 2 Nov 2021 12:26:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 960E0100763D; Tue, 2 Nov 2021 16:26:39 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.194.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 35F38100751A; Tue, 2 Nov 2021 16:26:39 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 16A881805CB8; Tue, 2 Nov 2021 17:26:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635870419; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Ss/Hz3Amunh7qd04Lf0rLRk/NM7TeE6BsChzCFgfXdg=; b=feR9mbhXY0IbuaTD3TbIrEREKhm3d1chXDkT49fC/7BJy5Dqct/mPbHxUuKlSZN4Fc1FWM SF2B2awZwlFPeJc1DxfrHX3gKdtPlCYIPouIbA1tlr5G7i38UWRkTHN1SdmvOzS2uWz7kC K1sIqEEVHZ6k75OVnDWbte27MsggKg8= X-MC-Unique: jV2poLgqNL2h2Z2NeSMbNg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 10/10] usb-storage: tag usb_msd_csw as packed struct Date: Tue, 2 Nov 2021 17:26:19 +0100 Message-Id: <20211102162619.2760593-11-kraxel@redhat.com> In-Reply-To: <20211102162619.2760593-1-kraxel@redhat.com> References: <20211102162619.2760593-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Thomas Huth , Eduardo Habkost , Sergio Lopez , "Michael S. Tsirkin" , libvir-list@redhat.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , vintagepc404@protonmail.com, Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Willian Rampazzo , Gerd Hoffmann , Marcel Apfelbaum , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1635870421634100005 Without this the struct has the wrong size: sizeof() evaluates to 16 instead of 13. In most cases the bug is hidden by the fact that guests submits a buffer which is exactly 13 bytes long, so the padding added by the compiler is simply ignored. But sometimes guests submit a larger buffer and expect a short transfer, which does not work properly with the wrong struct size. Cc: vintagepc404@protonmail.com Signed-off-by: Gerd Hoffmann Fixes: a917d384ac0 ("SCSI TCQ support.") Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210906045523.1259629-1-kraxel@redhat.com> --- include/hw/usb/msd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/usb/msd.h b/include/hw/usb/msd.h index 7538c54569bf..54e9f38bda46 100644 --- a/include/hw/usb/msd.h +++ b/include/hw/usb/msd.h @@ -17,7 +17,7 @@ enum USBMSDMode { USB_MSDM_CSW /* Command Status. */ }; =20 -struct usb_msd_csw { +struct QEMU_PACKED usb_msd_csw { uint32_t sig; uint32_t tag; uint32_t residue; --=20 2.31.1