Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp526252ybv; Wed, 19 Feb 2020 04:21:27 -0800 (PST) X-Google-Smtp-Source: APXvYqyjSZJLpmHHbi2Apvse4Cqv5s51jbEwmF6LJ6okvRNgG1QPLCEeWnINg+nwUJzjHZzdQD61 X-Received: by 2002:a05:6808:5d0:: with SMTP id d16mr4396839oij.45.1582114886935; Wed, 19 Feb 2020 04:21:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582114886; cv=none; d=google.com; s=arc-20160816; b=GcCyh1w4UOVYE/A+godW6DzpwC0ehqLQjPS2FzVUtU5IGGl/UEh6qMShh+cMhWlRdV /9DexDcJhmz4LWLgXWLpy+SgTVOUVaOWXJZbvU4alm0Eb/7fHPEHK0m1DpDubc6SofV9 yPL0O6e7UQC8euQi4Q3CaRbqDWrr8S1foiDK5LuOWA6xR7+oxZ9azhKkFOpSjka8EU9j 7sW2xHVIWTRveUJQzmjVSxQtfzSfPLRc2+EeHBDSAG/uvtZ4U9yCkh+TfJKe3cnWOWKD tBR2E+OH88GWpO8nOO4c2rh/FV/8X7aT1rwwtNvXg6BvNxB8lFCqEtqUy6sxUNvuPA2s N7bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=gQ4jhduPvu3Aly7RVP3W5b9uRdvq615dwjzLBQI/A3g=; b=KtBcJcHlEJ6Tgpsv6UzLnDnE+OQcsePkY2uhlP2mZz/kgIo5jAvPmSThjGl5ZlrJi9 ZVVTt5GM2NVb+lqWqCy8cS3uiZQt6twTmf653tcHXfZLbJVUSlAvGGSsMtPGQTfrQipy fn+PD4Y7Pd+8iQshKI7kwrDMLNFcPDUrwmBRC5j6Y+mmsLDdEf69XI+DaGyOj3JAF10w 6H41PkiS6n8lLg0JnHcPhZbze49IDrLqGe+MVydjeiIyhPalh1k+Lg2UuodKQpibEfNU eM27NT/jDYNF2EmoWfM3JGBEGtjqOQOixOlznSNO3TDWDxP3He9WT4criVejE2ZRBsbC T8TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yzrGPBd+; 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=pass (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 l80si9147812oib.268.2020.02.19.04.21.13; Wed, 19 Feb 2020 04:21:26 -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; dkim=pass header.i=@kernel.org header.s=default header.b=yzrGPBd+; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727333AbgBSMUJ (ORCPT + 99 others); Wed, 19 Feb 2020 07:20:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:42874 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726514AbgBSMUJ (ORCPT ); Wed, 19 Feb 2020 07:20:09 -0500 Received: from localhost (unknown [106.201.32.165]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 82F30206EF; Wed, 19 Feb 2020 12:20:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582114808; bh=umQ4SKOLayJpADzjnV+3+JTUjA7J2bacWdC3K1bXCVY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=yzrGPBd+oMrtgzLBfcPKULQ5GZHRdw8nM1eaeupegNNel9F025wXmSXdahGxb3xHf 7i2nrECYzAWc66Be6Uf6gBiUoiqB800uOlP7Y9p2MbX/8qwlLLda8jCHUwn2Kar+Z4 PG2LG1DZasQaLIuQKw0lEcLD6cnCVyb0iNbCfmf0= Date: Wed, 19 Feb 2020 17:50:04 +0530 From: Vinod Koul To: "Gustavo A. R. Silva" Cc: Dan Williams , Orson Zhai , Baolin Wang , Chunyan Zhang , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] dmaengine: sprd: Replace zero-length array with flexible-array member Message-ID: <20200219122004.GL2618@vkoul-mobl> References: <20200214171536.GA24077@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200214171536.GA24077@embeddedor> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14-02-20, 11:15, Gustavo A. R. Silva wrote: > 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] Applied, thanks -- ~Vinod