Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4760853ybf; Wed, 4 Mar 2020 10:07:16 -0800 (PST) X-Google-Smtp-Source: ADFU+vukzoP6n+qSn6ez1a5U4cjwyTxdf7V78eNbviZFii0rakgRW9214m+/ul3xBhSdWyQpI6NC X-Received: by 2002:a9d:7745:: with SMTP id t5mr3521527otl.282.1583345236092; Wed, 04 Mar 2020 10:07:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583345236; cv=none; d=google.com; s=arc-20160816; b=v/NAJs9uMtHSNvGCMejQ0YgSwxO1uvKL5pDRXl0BsA8DYu+sTjcZo6iQiq9y7g7y39 iU7/1AFetnqLRkzWIMARhWUCsjWxB9hQge/pidl3rCq9gJrcjLAfdi7cXUKN8/lwBKdq SZz/qqVEUg2MGUd1TYmiFaXdK3xsNE8StoJ4R0Bmy9GpuIduKskJy/4SV/H4039ZYSJe ErNWAhqnHQpr5xeZ7K+1O/DBO0frR1xFpFy/sbUI9RHeE8bEzT7St3pGaqAcbwBaXCGX kwf+2A/23hpxbOYrokf/NGoNVz+SaLTkLcMBxawBFp3rI71CtcBA9HtVLJpNYUrIId1F 2Lqg== 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=T80U1cVkj1EWz2dJv1hrjPavh+RfGxhggFbB61SqhBE=; b=dz2Drnf0d27O9+5i1+NUP/RYnSNGwJ7QOZNMmemUmWwA821v1GeQ0/XpsnHtCKypjN 8ff1XebsOPF/yigIQonCQ9H4XjLQ4rJA/a1Opg5k9aWSkLOwcidMHDndhacflhxE6oHS TmmgkWqunOua9zOswIsBo7Yxaq500is9TrrmQIYVFqfcgA6Ummplh1NrAkGbSottuFWU AOCnPqsl6j70AiK/SQ1yPF9rSq8FvWTlOCIkCEHrokvondU/W7Q++SLlZ2P7Inr6r+cW tQgou3hOoNRVs/xM1rn3DruKR1yRVtO7r1n78PazOGj1RSMQAdybfd6NZdi85jOcZQI5 iYEA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v7si1549428otp.43.2020.03.04.10.07.03; Wed, 04 Mar 2020 10:07: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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729976AbgCDSGo (ORCPT + 99 others); Wed, 4 Mar 2020 13:06:44 -0500 Received: from foss.arm.com ([217.140.110.172]:38130 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728926AbgCDSGn (ORCPT ); Wed, 4 Mar 2020 13:06:43 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C1E5831B; Wed, 4 Mar 2020 10:06:42 -0800 (PST) Received: from e121166-lin.cambridge.arm.com (e121166-lin.cambridge.arm.com [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3CDEC3F6C4; Wed, 4 Mar 2020 10:06:41 -0800 (PST) Date: Wed, 4 Mar 2020 18:06:35 +0000 From: Lorenzo Pieralisi To: Wei Liu Cc: 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: <20200304180635.GA21844@e121166-lin.cambridge.arm.com> References: <20200213005048.GA9662@embeddedor.com> <20200304175509.dwhn63omfzewaukv@debian> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200304175509.dwhn63omfzewaukv@debian> User-Agent: Mutt/1.9.4 (2018-02-28) 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 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. Lorenzo