[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH-for-5.2? v3 3/9] hw/usb: reorder fields in UASStatus
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH-for-5.2? v3 3/9] hw/usb: reorder fields in UASStatus |
Date: |
Fri, 6 Nov 2020 15:28:06 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 |
On 11/5/20 11:18 PM, Daniele Buono wrote:
> The UASStatus data structure has a variable sized field inside of type uas_iu,
> that however is not placed at the end of the data structure.
>
> This placement triggers a warning with clang 11, and while not a bug right
> now,
> (the status is never a uas_iu_command, which is the variable-sized case),
> it could become one in the future.
The problem is uas_iu_command::add_cdb, indeed.
>
> ../qemu-base/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]
If possible remove the "../qemu-base/" as it does not provide
any useful information.
> uas_iu status;
> ^
> 1 error generated.
>
> Fix this by moving uas_iu at the end of the struct
Your patch silents the warning, but the problem is the same.
It would be safer/cleaner to make 'status' a pointer on the heap IMO.
>
> Signed-off-by: Daniele Buono <dbuono@linux.vnet.ibm.com>
> ---
> 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 cec071d96c..5ef3f4fec9 100644
> --- a/hw/usb/dev-uas.c
> +++ b/hw/usb/dev-uas.c
> @@ -154,9 +154,9 @@ struct UASRequest {
>
> struct UASStatus {
> uint32_t stream;
> - uas_iu status;
> uint32_t length;
> QTAILQ_ENTRY(UASStatus) next;
> + uas_iu status;
> };
>
> /* --------------------------------------------------------------------- */
>
- [PATCH v3 6/9] configure,meson: add option to enable LTO, (continued)
[PATCH v3 7/9] cfi: Initial support for cfi-icall in QEMU, Daniele Buono, 2020/11/05
[PATCH v3 8/9] check-block: enable iotests with cfi-icall, Daniele Buono, 2020/11/05
[PATCH v3 9/9] configure,meson: support Control-Flow Integrity, Daniele Buono, 2020/11/05
[PATCH v3 3/9] hw/usb: reorder fields in UASStatus, Daniele Buono, 2020/11/05
- Re: [PATCH-for-5.2? v3 3/9] hw/usb: reorder fields in UASStatus,
Philippe Mathieu-Daudé <=
Re: [PATCH v3 0/9] Add support for Control-Flow Integrity, Cornelia Huck, 2020/11/06