qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] usb: Fix clang build


From: Eric Blake
Subject: [PATCH] usb: Fix clang build
Date: Tue, 19 Jan 2021 17:07:41 -0600

../hw/usb/dev-uas.c:157:31: error: field 'status' with variable sized type 
'uas_iu' not at the end of a struct or class is a GNU extension 
[-Werror,-Wgnu-variable-sized-type-not-at-end]
    uas_iu                    status;
                              ^

Fix this by specifying a size for the add_cdb member; and at present,
the code does not actually use that field other than for the size
chosen for the packed uas_iu_command struct, and the choice of one
byte does not change the size of the uas_iu union.

Signed-off-by: Eric Blake <eblake@redhat.com>
---

I'm not sure why none of our CI tools pick up this particular clang
build failure; I hit it on Fedora 33 when configuring to build the
entire tree with clang.

 hw/usb/dev-uas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c
index cec071d96c49..904d6ffa2938 100644
--- a/hw/usb/dev-uas.c
+++ b/hw/usb/dev-uas.c
@@ -70,7 +70,7 @@ typedef struct {
     uint8_t    reserved_2;
     uint64_t   lun;
     uint8_t    cdb[16];
-    uint8_t    add_cdb[];
+    uint8_t    add_cdb[1];
 } QEMU_PACKED  uas_iu_command;

 typedef struct {
-- 
2.30.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]