From patchwork Thu Nov 2 20:01:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 833525 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ySbZK5kLKz9sNV for ; Fri, 3 Nov 2017 07:01:29 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3ySbZK40C4zDr8c for ; Fri, 3 Nov 2017 07:01:29 +1100 (AEDT) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=redhat.com (client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=thuth@redhat.com; receiver=) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3ySbZF4RrKzDr8Q for ; Fri, 3 Nov 2017 07:01:25 +1100 (AEDT) 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 mx1.redhat.com (Postfix) with ESMTPS id B54CF85547 for ; Thu, 2 Nov 2017 20:01:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B54CF85547 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=thuth@redhat.com Received: from thh440s.redhat.com (ovpn-116-127.ams2.redhat.com [10.36.116.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2037D60602 for ; Thu, 2 Nov 2017 20:01:22 +0000 (UTC) From: Thomas Huth To: slof@lists.ozlabs.org Date: Thu, 2 Nov 2017 21:01:22 +0100 Message-Id: <1509652882-7144-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 02 Nov 2017 20:01:23 +0000 (UTC) Subject: [SLOF] [PATCH] libvirtio: Mark struct virtio_scsi_req_cmd as packed X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" The struct contains an uneven amount of bytes, so we should use the "packed" attribute to avoid padding problems here. So far the problems did not show up yet since the struct is filled by Forth code only and QEMU seems to be quite forgiving about the length of the descriptor, but anyway, let's better be safe than sorry here. Signed-off-by: Thomas Huth Reviewed-by: Nikunj A Dadhania --- lib/libvirtio/virtio-scsi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libvirtio/virtio-scsi.h b/lib/libvirtio/virtio-scsi.h index 451ba4d..d598dea 100644 --- a/lib/libvirtio/virtio-scsi.h +++ b/lib/libvirtio/virtio-scsi.h @@ -47,7 +47,7 @@ struct virtio_scsi_req_cmd { uint8_t prio; uint8_t crn; char cdb[VIRTIO_SCSI_CDB_SIZE]; -}; +} __attribute__((packed)); /* This is the first element of the "in" scatter-gather list. */ struct virtio_scsi_resp_cmd {