From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 2002:ac2:4942:0:0:0:0:0 with SMTP id o2csp1488365lfi; Wed, 4 Mar 2020 03:15:09 -0800 (PST) X-Google-Smtp-Source: ADFU+vvj7tzAFm8xppvjRH5b2SqBS3Kb31ItXosTzBbg4HJNpayDQXhROLl1UUKMnTBwS5rOoxu5 X-Received: by 2002:a05:620a:2118:: with SMTP id l24mr2229726qkl.383.1583320509723; Wed, 04 Mar 2020 03:15:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583320509; cv=none; d=google.com; s=arc-20160816; b=n+VLyISu1IpnOOdAKPzzMPPUPh6UtMS11WFYycYULBvnQbfWezXIuw2J1k0SIJVngF 2jerZeF6XbXtgML8+MuiC5MQxuV65tkzEEwz8Z9XgRQO86wAEC7Ez008O8gh4RPL7NFz lXoGVZ5qsVT0f7gCajbt+u6i40yvNVRnJYFqWJKqBrd5WijO8KBzHHMFMEIvXqdsEq7Z Adul99mRwZGGLU7t7X+yRqttIfBw93DxIoKhOECu57rfvKjMv1S7w7llS2u0v4CIVb4Q lfXPgrrrgU4lHXCxUqyA50GSJodsA+kL66Jlu6g6qPoFBge6tuxP5drxVOg0YSrRn0tw wT9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature; bh=HSK98NP1FXKbRshKg14Z6I9R093MnlZSyFArmEQhph8=; b=GyjzIpkdq02YW97sRqf9DPcjH4mSCCvi0WSQaxErqfQtz+t3znYeIqK02YCmnlDPvz m6Zin4q9CoUIyijsH7/t3hMcxKkcXg60X/sregeyikfHofGJY2MshazlJ4KjrYsvt/hL MZ34VXGjT2fXt6w6fUEZYEFXKf4laIa+/XFBpU+HH8DPCvKBiyp0ZSHdPF6TRzH5L3hn UXVZNWH9Y20/6ihhPTeeaA0l7v4JwCHPagUKI2HeuKefxTJkV6ptewbHAZNZP4x0ig5a yN9TF1oJ2snHEoMUmbVjmcjNVF9cZ2h08IJqNNbTUi4EUrYxdLtRsMGFbT4u+xMbjfRi MqXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=ikcmFJVk; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g8si748975qto.369.2020.03.04.03.15.09 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Mar 2020 03:15:09 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=ikcmFJVk; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:32770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9RzZ-0004nr-4l for alex.bennee@linaro.org; Wed, 04 Mar 2020 06:15:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39257) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9RzQ-0004mQ-Nn for qemu-arm@nongnu.org; Wed, 04 Mar 2020 06:15:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9RzP-0005qk-J0 for qemu-arm@nongnu.org; Wed, 04 Mar 2020 06:15:00 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:23935 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j9RzP-0005oP-43 for qemu-arm@nongnu.org; Wed, 04 Mar 2020 06:14:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583320498; h=from:from: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; bh=HSK98NP1FXKbRshKg14Z6I9R093MnlZSyFArmEQhph8=; b=ikcmFJVk8c+t1XLwYTuoWhXK3yE7ptuSJpAY3N91kw+8YtdgXACsPPjSesUyRlsGNWnrz0 2Zj+a9RmYmeXFDYoHk+HEjS5vOxRY44EctcT6OePAM1WkDLiHrMgnXgPt9Rfvtetc6zi9j BTf1S4Ox77OJOY0/Bz7TeL/co1n5QaI= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-339-JpH0Ci6UMqirx7Oc_SHTxg-1; Wed, 04 Mar 2020 06:14:56 -0500 X-MC-Unique: JpH0Ci6UMqirx7Oc_SHTxg-1 Received: by mail-wr1-f70.google.com with SMTP id b12so721037wro.4 for ; Wed, 04 Mar 2020 03:14:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=AWb2lS/0Q4WHKen5zSqK5CWqt+E1FAZE9sUsehJoDaA=; b=m3RUU7i+7DSCUEtz5NCMui0U9y2OcpWG//KAdxvloE6F5z5FarPVv3TnKNBM4FbMH6 ktDRWWSwQKQ2X1tEgJpc2mHlN999K517LZ4G8mDR3R4wETWdZ+ygJZnuicFdq1rKT5KZ CX5pJeDorUMp+0S+JOG7RbDn47zcumI4hflyvel2p4gaf+JfNsV9n1DbVZNjPbKX0Gk1 1KGcQPlwqpcN/ZL2Pau8hFKLbMn9suQKRZUwu7LMKxn9xrqq93pH5Cu11nAxSOAfzSnN gqst6ra2ZAJVTALUQ87tEHCAlGMkWP3tcVjHSPcDpl1uk2OZjWg5JbNf7pLWFa7GySTV bW0g== X-Gm-Message-State: ANhLgQ03HcvcJJuhsfgjykqs8LnnN0fW2wuPXACUN00opSCptTGODyQn FNEaxRrXvSMXssHUpe7m3lEZnW6yI2K233j0MTzLG41L7CSOxdYhZ59v6PEYXjbahAyMqjks/J9 qxNf9jSi7RJaa X-Received: by 2002:adf:b609:: with SMTP id f9mr3364453wre.380.1583320494961; Wed, 04 Mar 2020 03:14:54 -0800 (PST) X-Received: by 2002:adf:b609:: with SMTP id f9mr3364408wre.380.1583320494634; Wed, 04 Mar 2020 03:14:54 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:9def:34a0:b68d:9993? ([2001:b07:6468:f312:9def:34a0:b68d:9993]) by smtp.gmail.com with ESMTPSA id i7sm4213331wma.32.2020.03.04.03.14.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Mar 2020 03:14:53 -0800 (PST) Subject: Re: [PATCH 0/2] misc: Replace zero-length arrays with flexible array member To: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , qemu-devel@nongnu.org References: <20200304005105.27454-1-philmd@redhat.com> From: Paolo Bonzini Message-ID: <447f74eb-d47e-e03c-5686-ae02a700d040@redhat.com> Date: Wed, 4 Mar 2020 12:14:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200304005105.27454-1-philmd@redhat.com> Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Yuval Shaia , Gerd Hoffmann , Eric Blake , Stefano Stabellini , qemu-block@nongnu.org, David Hildenbrand , Halil Pasic , Christian Borntraeger , "Gonglei \(Arei\)" , Marcel Apfelbaum , Anthony Perard , =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , Thomas Huth , Eduardo Habkost , Paul Durrant , Eric Auger , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, xen-devel@lists.xenproject.org, John Snow , Richard Henderson , Kevin Wolf , Xiao Guangrong , Cornelia Huck , Laurent Vivier , Max Reitz , Igor Mammedov Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: 3Id5r5yb0dAR On 04/03/20 01:51, Philippe Mathieu-Daud=C3=A9 wrote: > This is a tree-wide cleanup inspired by a Linux kernel commit > (from Gustavo A. R. Silva). >=20 > --v-- description start --v-- >=20 > The current codebase makes use of the zero-length array language > extension to the C90 standard, but the preferred mechanism to > declare variable-length types such as these ones is a flexible > array member [1], introduced in C99: >=20 > struct foo { > int stuff; > struct boo array[]; > }; >=20 > By making use of the mechanism above, we will get a compiler > warning in case the flexible array does not occur last in the > structure, which will help us prevent some kind of undefined > behavior bugs from being unadvertenly introduced [2] to the > Linux codebase from now on. >=20 > --^-- description end --^-- >=20 > Do the similar housekeeping in the QEMU codebase (which uses > C99 since commit 7be41675f7cb). >=20 > The first patch is done with the help of a coccinelle semantic > patch. However Coccinelle does not recognize: >=20 > struct foo { > int stuff; > struct boo array[]; > } QEMU_PACKED; >=20 > but does recognize: >=20 > struct QEMU_PACKED foo { > int stuff; > struct boo array[]; > }; >=20 > I'm not sure why, neither it is worth refactoring all QEMU > structures to use the attributes before the structure name, > so I did the 2nd patch manually. >=20 > Anyway this is annoying, because many structures are not handled > by coccinelle. Maybe this needs to be reported to upstream > coccinelle? >=20 > I used spatch 1.0.8 with: >=20 > -I include --include-headers \ > --macro-file scripts/cocci-macro-file.h \ > --keep-comments --indent 4 >=20 > Regards, >=20 > Phil. >=20 > Philippe Mathieu-Daud=C3=A9 (2): > misc: Replace zero-length arrays with flexible array member > (automatic) > misc: Replace zero-length arrays with flexible array member (manual) >=20 > docs/interop/vhost-user.rst | 4 ++-- > block/qed.h | 2 +- > bsd-user/qemu.h | 2 +- > contrib/libvhost-user/libvhost-user.h | 2 +- > hw/m68k/bootinfo.h | 2 +- > hw/scsi/srp.h | 6 +++--- > hw/xen/xen_pt.h | 2 +- > include/hw/acpi/acpi-defs.h | 16 ++++++++-------- > include/hw/arm/smmu-common.h | 2 +- > include/hw/boards.h | 2 +- > include/hw/i386/intel_iommu.h | 3 ++- > include/hw/s390x/event-facility.h | 2 +- > include/hw/s390x/sclp.h | 8 ++++---- > include/hw/virtio/virtio-iommu.h | 2 +- > include/sysemu/cryptodev.h | 2 +- > include/tcg/tcg.h | 2 +- > pc-bios/s390-ccw/bootmap.h | 2 +- > pc-bios/s390-ccw/sclp.h | 2 +- > tests/qtest/libqos/ahci.h | 2 +- > block/linux-aio.c | 2 +- > block/vmdk.c | 2 +- > hw/acpi/nvdimm.c | 6 +++--- > hw/char/sclpconsole-lm.c | 2 +- > hw/char/sclpconsole.c | 2 +- > hw/dma/soc_dma.c | 2 +- > hw/i386/x86.c | 2 +- > hw/misc/omap_l4.c | 2 +- > hw/nvram/eeprom93xx.c | 2 +- > hw/rdma/vmw/pvrdma_qp_ops.c | 4 ++-- > hw/s390x/virtio-ccw.c | 2 +- > hw/usb/dev-network.c | 2 +- > hw/usb/dev-smartcard-reader.c | 4 ++-- > hw/virtio/virtio.c | 4 ++-- > net/queue.c | 2 +- > target/s390x/ioinst.c | 2 +- > 35 files changed, 54 insertions(+), 53 deletions(-) >=20 Queued (minus the qed part). Paolo From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40D57C3F2D1 for ; Wed, 4 Mar 2020 11:15:22 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D84220709 for ; Wed, 4 Mar 2020 11:15:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="jVHxVYDq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D84220709 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j9RzP-0002dI-3q; Wed, 04 Mar 2020 11:14:59 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j9RzO-0002d9-M7 for xen-devel@lists.xenproject.org; Wed, 04 Mar 2020 11:14:58 +0000 X-Inumbo-ID: 61efafce-5e09-11ea-b52f-bc764e2007e4 Received: from us-smtp-1.mimecast.com (unknown [207.211.31.120]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id 61efafce-5e09-11ea-b52f-bc764e2007e4; Wed, 04 Mar 2020 11:14:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583320497; h=from:from: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; bh=HSK98NP1FXKbRshKg14Z6I9R093MnlZSyFArmEQhph8=; b=jVHxVYDqsIgygnbH0IAylxxviwMJxVk/KprJa4S6uQHHTo/1CD7Bqw5BEaTwSCsA+ucBFt BIgwNLQO3MGBbrvHpZnChSPqItNPYgtpjNaJICaZ3c6ckJqcDu/4v4s5QbfqErFMSFR1SZ DvAqCINeJL9uscMOlskjq4KIqxqx+nw= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-197-hpsKYO2aMe23KprQjK_6uw-1; Wed, 04 Mar 2020 06:14:56 -0500 X-MC-Unique: hpsKYO2aMe23KprQjK_6uw-1 Received: by mail-wr1-f71.google.com with SMTP id w8so707798wrn.7 for ; Wed, 04 Mar 2020 03:14:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=AWb2lS/0Q4WHKen5zSqK5CWqt+E1FAZE9sUsehJoDaA=; b=LKPweujereKWiAsLwiDPaXvEV8J47GW1mjjFP8StG5qBXLRXRoe7SmzhMIxBFXAMEu 2gqTZXGpQl+iiyqyU5cg0yr73kGe6/5m76dbXs5U+WWDMmKJjWL9Zyg2r+fHkXsNe5YD wX3MEPJWPkQXm6X4JBuNH5/5fKmIbXc05ZJc1wS+urMAfh62Oli5+wbeyUFcKsBEvnGU KomRKzW7A+CAOvayAbdqDnTiU0p62VxFcOTydtMyOAYh8PpKE4LXpIq2jA2hMLXZNctw LnzpqYRg/4UOympzwk+a2D+5ZtL+8CL9dXkU/gN8zUw62oxXPX/Kz7P/mcaB1uoTJ9/3 8pLA== X-Gm-Message-State: ANhLgQ0r063HxCWwnBnTT5pn9O+G6ElgXPnkJfIBfcBOSm0weLXLEgjc 4EVZp6zxow23353siIpAAZI6UHZ8p/noy85Fx0WpiVwWlBUwm2H2Kd3h8CxO3svY0El3Mr4RTXq W3otGXSWGFkELUJ+ChqocMqNyD6E= X-Received: by 2002:adf:b609:: with SMTP id f9mr3364441wre.380.1583320494959; Wed, 04 Mar 2020 03:14:54 -0800 (PST) X-Google-Smtp-Source: ADFU+vuhY3YUEefrzO8BOCtqRLYBt54qdDwnDOEIPq+r1gfcWz9xqg2WwOWhIwqFr0RVqL8jYffVNQ== X-Received: by 2002:adf:b609:: with SMTP id f9mr3364408wre.380.1583320494634; Wed, 04 Mar 2020 03:14:54 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:9def:34a0:b68d:9993? ([2001:b07:6468:f312:9def:34a0:b68d:9993]) by smtp.gmail.com with ESMTPSA id i7sm4213331wma.32.2020.03.04.03.14.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Mar 2020 03:14:53 -0800 (PST) To: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , qemu-devel@nongnu.org References: <20200304005105.27454-1-philmd@redhat.com> From: Paolo Bonzini Message-ID: <447f74eb-d47e-e03c-5686-ae02a700d040@redhat.com> Date: Wed, 4 Mar 2020 12:14:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200304005105.27454-1-philmd@redhat.com> Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: Re: [Xen-devel] [PATCH 0/2] misc: Replace zero-length arrays with flexible array member X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Yuval Shaia , Gerd Hoffmann , Eric Blake , Stefano Stabellini , qemu-block@nongnu.org, David Hildenbrand , Halil Pasic , Christian Borntraeger , "Gonglei \(Arei\)" , Marcel Apfelbaum , Anthony Perard , =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , Thomas Huth , Eduardo Habkost , Paul Durrant , Eric Auger , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, xen-devel@lists.xenproject.org, John Snow , Richard Henderson , Kevin Wolf , Xiao Guangrong , Cornelia Huck , Laurent Vivier , Max Reitz , Igor Mammedov Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" T24gMDQvMDMvMjAgMDE6NTEsIFBoaWxpcHBlIE1hdGhpZXUtRGF1ZMOpIHdyb3RlOgo+IFRoaXMg aXMgYSB0cmVlLXdpZGUgY2xlYW51cCBpbnNwaXJlZCBieSBhIExpbnV4IGtlcm5lbCBjb21taXQK PiAoZnJvbSBHdXN0YXZvIEEuIFIuIFNpbHZhKS4KPiAKPiAtLXYtLSBkZXNjcmlwdGlvbiBzdGFy dCAtLXYtLQo+IAo+ICAgVGhlIGN1cnJlbnQgY29kZWJhc2UgbWFrZXMgdXNlIG9mIHRoZSB6ZXJv LWxlbmd0aCBhcnJheSBsYW5ndWFnZQo+ICAgZXh0ZW5zaW9uIHRvIHRoZSBDOTAgc3RhbmRhcmQs IGJ1dCB0aGUgcHJ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GUgYXJyYXkgbWVtYmVyIChtYW51YWwpCj4gCj4gIGRvY3MvaW50ZXJvcC92aG9zdC11c2VyLnJz dCAgICAgICAgICAgfCAgNCArKy0tCj4gIGJsb2NrL3FlZC5oICAgICAgICAgICAgICAgICAgICAg ICAgICAgfCAgMiArLQo+ICBic2QtdXNlci9xZW11LmggICAgICAgICAgICAgICAgICAgICAgIHwg IDIgKy0KPiAgY29udHJpYi9saWJ2aG9zdC11c2VyL2xpYnZob3N0LXVzZXIuaCB8ICAyICstCj4g IGh3L202OGsvYm9vdGluZm8uaCAgICAgICAgICAgICAgICAgICAgfCAgMiArLQo+ICBody9zY3Np L3NycC5oICAgICAgICAgICAgICAgICAgICAgICAgIHwgIDYgKysrLS0tCj4gIGh3L3hlbi94ZW5f cHQuaCAgICAgICAgICAgICAgICAgICAgICAgfCAgMiArLQo+ICBpbmNsdWRlL2h3L2FjcGkvYWNw aS1kZWZzLmggICAgICAgICAgIHwgMTYgKysrKysrKystLS0tLS0tLQo+ICBpbmNsdWRlL2h3L2Fy bS9zbW11LWNvbW1vbi5oICAgICAgICAgIHwgIDIgKy0KPiAgaW5jbHVkZS9ody9ib2FyZHMuaCAg ICAgICAgICAgICAgICAgICB8ICAyICstCj4gIGluY2x1ZGUvaHcvaTM4Ni9pbnRlbF9pb21tdS5o ICAgICAgICAgfCAgMyArKy0KPiAgaW5jbHVkZS9ody9zMzkweC9ldmVudC1mYWNpbGl0eS5oICAg ICB8ICAyICstCj4gIGluY2x1ZGUvaHcvczM5MHgvc2NscC5oICAgICAgICAgICAgICAgfCAgOCAr KysrLS0tLQo+ICBpbmNsdWRlL2h3L3ZpcnRpby92aXJ0aW8taW9tbXUuaCAgICAgIHwgIDIgKy0K PiAgaW5jbHVkZS9zeXNlbXUvY3J5cHRvZGV2LmggICAgICAgICAgICB8ICAyICstCj4gIGluY2x1 ZGUvdGNnL3RjZy5oICAgICAgICAgICAgICAgICAgICAgfCAgMiArLQo+ICBwYy1iaW9zL3MzOTAt Y2N3L2Jvb3RtYXAuaCAgICAgICAgICAgIHwgIDIgKy0KPiAgcGMtYmlvcy9zMzkwLWNjdy9zY2xw LmggICAgICAgICAgICAgICB8ICAyICstCj4gIHRlc3RzL3F0ZXN0L2xpYnFvcy9haGNpLmggICAg ICAgICAgICAgfCAgMiArLQo+ICBibG9jay9saW51eC1haW8uYyAgICAgICAgICAgICAgICAgICAg IHwgIDIgKy0KPiAgYmxvY2svdm1kay5jICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAyICst Cj4gIGh3L2FjcGkvbnZkaW1tLmMgICAgICAgICAgICAgICAgICAgICAgfCAgNiArKystLS0KPiAg aHcvY2hhci9zY2xwY29uc29sZS1sbS5jICAgICAgICAgICAgICB8ICAyICstCj4gIGh3L2NoYXIv c2NscGNvbnNvbGUuYyAgICAgICAgICAgICAgICAgfCAgMiArLQo+ICBody9kbWEvc29jX2RtYS5j ICAgICAgICAgICAgICAgICAgICAgIHwgIDIgKy0KPiAgaHcvaTM4Ni94ODYuYyAgICAgICAgICAg ICAgICAgICAgICAgICB8ICAyICstCj4gIGh3L21pc2Mvb21hcF9sNC5jICAgICAgICAgICAgICAg ICAgICAgfCAgMiArLQo+ICBody9udnJhbS9lZXByb205M3h4LmMgICAgICAgICAgICAgICAgIHwg IDIgKy0KPiAgaHcvcmRtYS92bXcvcHZyZG1hX3FwX29wcy5jICAgICAgICAgICB8ICA0ICsrLS0K PiAgaHcvczM5MHgvdmlydGlvLWNjdy5jICAgICAgICAgICAgICAgICB8ICAyICstCj4gIGh3L3Vz Yi9kZXYtbmV0d29yay5jICAgICAgICAgICAgICAgICAgfCAgMiArLQo+ICBody91c2IvZGV2LXNt YXJ0Y2FyZC1yZWFkZXIuYyAgICAgICAgIHwgIDQgKystLQo+ICBody92aXJ0aW8vdmlydGlvLmMg ICAgICAgICAgICAgICAgICAgIHwgIDQgKystLQo+ICBuZXQvcXVldWUuYyAgICAgICAgICAgICAg ICAgICAgICAgICAgIHwgIDIgKy0KPiAgdGFyZ2V0L3MzOTB4L2lvaW5zdC5jICAgICAgICAgICAg ICAgICB8ICAyICstCj4gIDM1IGZpbGVzIGNoYW5nZWQsIDU0IGluc2VydGlvbnMoKyksIDUzIGRl bGV0aW9ucygtKQo+IAoKUXVldWVkIChtaW51cyB0aGUgcWVkIHBhcnQpLgoKUGFvbG8KCgpfX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXwpYZW4tZGV2ZWwgbWFp bGluZyBsaXN0Clhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZwpodHRwczovL2xpc3RzLnhl bnByb2plY3Qub3JnL21haWxtYW4vbGlzdGluZm8veGVuLWRldmVs From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39BCCC3F2D1 for ; Wed, 4 Mar 2020 11:15:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0556220709 for ; Wed, 4 Mar 2020 11:15:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="jVHxVYDq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0556220709 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:32788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9S0B-0005VP-1h for qemu-devel@archiver.kernel.org; Wed, 04 Mar 2020 06:15:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39256) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9RzQ-0004mP-O3 for qemu-devel@nongnu.org; Wed, 04 Mar 2020 06:15:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9RzP-0005q5-7H for qemu-devel@nongnu.org; Wed, 04 Mar 2020 06:15:00 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:22073 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j9RzO-0005nI-Qh for qemu-devel@nongnu.org; Wed, 04 Mar 2020 06:14:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583320497; h=from:from: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; bh=HSK98NP1FXKbRshKg14Z6I9R093MnlZSyFArmEQhph8=; b=jVHxVYDqsIgygnbH0IAylxxviwMJxVk/KprJa4S6uQHHTo/1CD7Bqw5BEaTwSCsA+ucBFt BIgwNLQO3MGBbrvHpZnChSPqItNPYgtpjNaJICaZ3c6ckJqcDu/4v4s5QbfqErFMSFR1SZ DvAqCINeJL9uscMOlskjq4KIqxqx+nw= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-179-PYunPIcJNyKqyv_KX9w4-w-1; Wed, 04 Mar 2020 06:14:56 -0500 X-MC-Unique: PYunPIcJNyKqyv_KX9w4-w-1 Received: by mail-wm1-f69.google.com with SMTP id m4so711565wmi.5 for ; Wed, 04 Mar 2020 03:14:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=AWb2lS/0Q4WHKen5zSqK5CWqt+E1FAZE9sUsehJoDaA=; b=SvODVEc0XHz24moE49lT848U7B3fkuSepFXzr0hpgZV/RnDsiXkEa2jyIam//qI/I6 V0vth4NiIcsMQ2teziGHvXDJxtlBfcp0SnzXorK3JN9POHSatV6bh6YtLHkMFGs9Vg5b UTgI5e0AsWD6a5Gi6v5zVBqasqz9Cf3y1cODuOv9HFG3cMfa2tlC7DLYuiq3rNd2aIiP Wi5glFefiAkO/jg/g5SyGFZFhmpghgUXSf8uvekHxy8ci0dozXXXLZRw1lWbjJX+Fz7x hf6O2yKITuDwq/+yVtKE/vqOBCaTxz6I4WSY3gYMY39WnyJ5Zg4THfBeOEFMJgkqPnB/ UEZQ== X-Gm-Message-State: ANhLgQ3J4ssHSdRfM5AS7F1nzxS/gMF16GNgRGLklN/VofHMmos5kWNZ KWqCB+cwVbl6fiQG+LQklaHSx/tlOVbqgVoVexlWWz2860qMgsr2c448kHUKJAEBD/WfrSQ5Uh3 XZWGlX9WHlCyYlFY= X-Received: by 2002:adf:b609:: with SMTP id f9mr3364469wre.380.1583320495033; Wed, 04 Mar 2020 03:14:55 -0800 (PST) X-Google-Smtp-Source: ADFU+vuhY3YUEefrzO8BOCtqRLYBt54qdDwnDOEIPq+r1gfcWz9xqg2WwOWhIwqFr0RVqL8jYffVNQ== X-Received: by 2002:adf:b609:: with SMTP id f9mr3364408wre.380.1583320494634; Wed, 04 Mar 2020 03:14:54 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:9def:34a0:b68d:9993? ([2001:b07:6468:f312:9def:34a0:b68d:9993]) by smtp.gmail.com with ESMTPSA id i7sm4213331wma.32.2020.03.04.03.14.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Mar 2020 03:14:53 -0800 (PST) Subject: Re: [PATCH 0/2] misc: Replace zero-length arrays with flexible array member To: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , qemu-devel@nongnu.org References: <20200304005105.27454-1-philmd@redhat.com> From: Paolo Bonzini Message-ID: <447f74eb-d47e-e03c-5686-ae02a700d040@redhat.com> Date: Wed, 4 Mar 2020 12:14:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200304005105.27454-1-philmd@redhat.com> Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Yuval Shaia , Gerd Hoffmann , Stefano Stabellini , qemu-block@nongnu.org, David Hildenbrand , Halil Pasic , Christian Borntraeger , "Gonglei \(Arei\)" , Anthony Perard , =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , Thomas Huth , Eduardo Habkost , Paul Durrant , Eric Auger , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, xen-devel@lists.xenproject.org, John Snow , Richard Henderson , Kevin Wolf , Xiao Guangrong , Cornelia Huck , Laurent Vivier , Max Reitz , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 04/03/20 01:51, Philippe Mathieu-Daud=C3=A9 wrote: > This is a tree-wide cleanup inspired by a Linux kernel commit > (from Gustavo A. R. Silva). >=20 > --v-- description start --v-- >=20 > The current codebase makes use of the zero-length array language > extension to the C90 standard, but the preferred mechanism to > declare variable-length types such as these ones is a flexible > array member [1], introduced in C99: >=20 > struct foo { > int stuff; > struct boo array[]; > }; >=20 > By making use of the mechanism above, we will get a compiler > warning in case the flexible array does not occur last in the > structure, which will help us prevent some kind of undefined > behavior bugs from being unadvertenly introduced [2] to the > Linux codebase from now on. >=20 > --^-- description end --^-- >=20 > Do the similar housekeeping in the QEMU codebase (which uses > C99 since commit 7be41675f7cb). >=20 > The first patch is done with the help of a coccinelle semantic > patch. However Coccinelle does not recognize: >=20 > struct foo { > int stuff; > struct boo array[]; > } QEMU_PACKED; >=20 > but does recognize: >=20 > struct QEMU_PACKED foo { > int stuff; > struct boo array[]; > }; >=20 > I'm not sure why, neither it is worth refactoring all QEMU > structures to use the attributes before the structure name, > so I did the 2nd patch manually. >=20 > Anyway this is annoying, because many structures are not handled > by coccinelle. Maybe this needs to be reported to upstream > coccinelle? >=20 > I used spatch 1.0.8 with: >=20 > -I include --include-headers \ > --macro-file scripts/cocci-macro-file.h \ > --keep-comments --indent 4 >=20 > Regards, >=20 > Phil. >=20 > Philippe Mathieu-Daud=C3=A9 (2): > misc: Replace zero-length arrays with flexible array member > (automatic) > misc: Replace zero-length arrays with flexible array member (manual) >=20 > docs/interop/vhost-user.rst | 4 ++-- > block/qed.h | 2 +- > bsd-user/qemu.h | 2 +- > contrib/libvhost-user/libvhost-user.h | 2 +- > hw/m68k/bootinfo.h | 2 +- > hw/scsi/srp.h | 6 +++--- > hw/xen/xen_pt.h | 2 +- > include/hw/acpi/acpi-defs.h | 16 ++++++++-------- > include/hw/arm/smmu-common.h | 2 +- > include/hw/boards.h | 2 +- > include/hw/i386/intel_iommu.h | 3 ++- > include/hw/s390x/event-facility.h | 2 +- > include/hw/s390x/sclp.h | 8 ++++---- > include/hw/virtio/virtio-iommu.h | 2 +- > include/sysemu/cryptodev.h | 2 +- > include/tcg/tcg.h | 2 +- > pc-bios/s390-ccw/bootmap.h | 2 +- > pc-bios/s390-ccw/sclp.h | 2 +- > tests/qtest/libqos/ahci.h | 2 +- > block/linux-aio.c | 2 +- > block/vmdk.c | 2 +- > hw/acpi/nvdimm.c | 6 +++--- > hw/char/sclpconsole-lm.c | 2 +- > hw/char/sclpconsole.c | 2 +- > hw/dma/soc_dma.c | 2 +- > hw/i386/x86.c | 2 +- > hw/misc/omap_l4.c | 2 +- > hw/nvram/eeprom93xx.c | 2 +- > hw/rdma/vmw/pvrdma_qp_ops.c | 4 ++-- > hw/s390x/virtio-ccw.c | 2 +- > hw/usb/dev-network.c | 2 +- > hw/usb/dev-smartcard-reader.c | 4 ++-- > hw/virtio/virtio.c | 4 ++-- > net/queue.c | 2 +- > target/s390x/ioinst.c | 2 +- > 35 files changed, 54 insertions(+), 53 deletions(-) >=20 Queued (minus the qed part). Paolo