Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4764887ybf; Wed, 4 Mar 2020 10:11:16 -0800 (PST) X-Google-Smtp-Source: ADFU+vvYtLvPH7sY+YZWioWkfd7H6MfFnNn4XGdrAU1h/YA1RnbPzd8K8Pfjkq3Twtia/Ob1OJ6h X-Received: by 2002:aca:1b11:: with SMTP id b17mr2711204oib.45.1583345476583; Wed, 04 Mar 2020 10:11:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583345476; cv=none; d=google.com; s=arc-20160816; b=DjGTciqzQqlHipSMqFe9SXWXv/WcxjkYgvY5vs7Ya9bYQkIKvQlUwhpAn7AehmiToT /sf5WMnN2aCH6N/692VHCxcWtpDtqbW8SVkhc9qhqVQc6phbvPWr1Fc0292EkoRgxG3L gO3Kir43MK5DJIPaKKCyPnxI4NiyZXM0Calhw7O9SVK8X/MENGjEv4Jqa/X7boyAX4sV PlJ8ZEQ40sbXgTmYfHisEweHSBDixZ5xLqdRcOvKhL9gS+IEvbghhWwtkJM+HDWlniVn HnnhweZRb9Jaf3/XSWE5gRr//MTmMo1ReAQ7DFWOIRrv7bEVkC1WfmwduVxqxGqyvItO 624g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=6K5mSx3hLH2eC6TJDpwRSBd6DNa0fXfEXM9YJbhKTUo=; b=U9JodoPajugAbfrmHo+LEx9ar/V9C51fFSwVHMxsM4gHXuVxhroityes2ey7rBdkjT MkL9/svfkKRrlt9gUsx+BDso+s2s2kxfevqZtYKwhC0Qwo+04pCkmNlz/9uWgrZjSAqQ iaAZjXig7SmkoIPhsva/+QUaHtUXXKXdtY/vIc+H6f+J0f3cCr/b4FWGWntdGnqcU2UW mHvm7yFu1vxFRawzSL3umJLj0aaUAq1UZzrClbuFxqqFV2VO8y63QKmFwdJSM8BE1sme mhapC77V7VdnnuFfwhBiepZN/YcVlU99YeY9NPonAwhEm4zSvCnFfCC4N0zW+XzwCpQ5 DPAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m19si1221553otq.4.2020.03.04.10.11.05; Wed, 04 Mar 2020 10:11:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388226AbgCDSKW (ORCPT + 99 others); Wed, 4 Mar 2020 13:10:22 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:33527 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388189AbgCDSKW (ORCPT ); Wed, 4 Mar 2020 13:10:22 -0500 Received: by mail-wm1-f65.google.com with SMTP id a25so5285872wmm.0; Wed, 04 Mar 2020 10:10:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=6K5mSx3hLH2eC6TJDpwRSBd6DNa0fXfEXM9YJbhKTUo=; b=X/blQgC7janOQG/uErT1N7XiZKBg6Xy1ve+jBJwpYUjlyKMs9GvWC+KJEfUZ7NezSz BsLAtkRSDgNKrjZJ7C06qL2IEXqsuZt7/j+AUmCMo2b23j65c/O9zztUjMm6ucfrHAJc FQ5Nprvk211O8Fg7CjADu9+RHBsf125RuRD6lU/PO8OHIUUGzD2PmlHPglV+paYnQTo8 BA58lHlZDhkvb0Z6Wlhh3Qs23+7kbSzABxwcwDZq3LkCvoLsjTEVEOxFHmem3cffj9/C GJ5X4QO1cD5jT76F8pknl8CTKL+YJEQn65raHOV3mQXYjCtYAzUKooERz3S7G0xM29PW z0LQ== X-Gm-Message-State: ANhLgQ1aUHQiOtqbmZ20K+tJNxlBB0Y/oNWQA3PqWfDHyL58bvtOYw2m OA20a/56bYFb1SLFk1w1qAY= X-Received: by 2002:a1c:750e:: with SMTP id o14mr4618729wmc.156.1583345420226; Wed, 04 Mar 2020 10:10:20 -0800 (PST) Received: from debian (41.142.6.51.dyn.plus.net. [51.6.142.41]) by smtp.gmail.com with ESMTPSA id z12sm3468853wrl.48.2020.03.04.10.10.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2020 10:10:19 -0800 (PST) Date: Wed, 4 Mar 2020 18:10:17 +0000 From: Wei Liu To: Lorenzo Pieralisi Cc: Wei Liu , Dexuan Cui , "Gustavo A. R. Silva" , KY Srinivasan , Haiyang Zhang , Stephen Hemminger , Sasha Levin , Andrew Murray , Bjorn Helgaas , "linux-hyperv@vger.kernel.org" , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] PCI: hv: Replace zero-length array with flexible-array member Message-ID: <20200304181017.epqvhmtegefb4eba@debian> References: <20200213005048.GA9662@embeddedor.com> <20200304175509.dwhn63omfzewaukv@debian> <20200304180635.GA21844@e121166-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200304180635.GA21844@e121166-lin.cambridge.arm.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 04, 2020 at 06:06:35PM +0000, Lorenzo Pieralisi wrote: > On Wed, Mar 04, 2020 at 05:55:09PM +0000, Wei Liu wrote: > > On Thu, Feb 13, 2020 at 03:43:40AM +0000, Dexuan Cui wrote: > > > > From: linux-hyperv-owner@vger.kernel.org > > > > On Behalf Of Gustavo A. R. Silva > > > > Sent: Wednesday, February 12, 2020 4:51 PM > > > > ... > > > > 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][2], > > > > introduced in C99: > > > > > > > > struct foo { > > > > int stuff; > > > > struct boo array[]; > > > > }; > > > > > > > > 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 > > > > inadvertently introduced[3] to the codebase from now on. > > > > > > > > Also, notice that, dynamic memory allocations won't be affected by > > > > this change: > > > > > > > > "Flexible array members have incomplete type, and so the sizeof operator > > > > may not be applied. As a quirk of the original implementation of > > > > zero-length arrays, sizeof evaluates to zero."[1] > > > > > > > > This issue was found with the help of Coccinelle. > > > > > > Looks good to me. Thanks, Gustavo! > > > > > > Reviewed-by: Dexuan Cui > > > > > > > Lorenzo, will you be picking up this patch? It seems to me you've been > > handling patches to pci-hyperv.c. This patch is not yet in pci/hv branch > > in your repository. > > > > Let me know what you think. > > I shall pick it up, I checked patchwork and it was erroneously > assigned to Bjorn, that's why I have not taken it yet. > > Fixed now, apologies, I will merge it shortly. Thanks for picking it up. Wei. > > Lorenzo