Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp625357ybv; Thu, 13 Feb 2020 06:47:57 -0800 (PST) X-Google-Smtp-Source: APXvYqwnkiWP3hvAG2YfO7rOUtQBSc2CnfRZedbrj7MGZOga9BpAD6+j648WH0xdrB2tshIy8yjT X-Received: by 2002:aca:ccce:: with SMTP id c197mr3052005oig.31.1581605277041; Thu, 13 Feb 2020 06:47:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581605277; cv=none; d=google.com; s=arc-20160816; b=U8U8uVsHt/w4pvD78/8LqMJODb8hAuAxT8MYQyW9BhUFQVHhsqEP5pMgICEmNgOCXh WIjlwUbsQj2qvSLOgu2Ex2phBxWctZFoRL9GsciFHfYVGnyT90brwBJP07Qm6YPSAUAA Xw8zHF+omSnQJyrGvL8dLlIbxj5mm53iCItZyPM0I7sCWy3cg8+ELUZTUMjSiiG6RDzq kQ500OgOBnM3fkEfeZA52rnJiJllkuiej85cle8zp/WBFOkXRocWZr/vE15STVGsawJ2 5OGBKTXQY/s1WdnUTfLEJNGGS1kF1iHgSqoWhRiib6Gd0SSyM/To3NAn0XQt8j7IfQdC 3oLQ== 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=SurMR3HBn/YfcBI5A8GNEok3uZRn8hGtzdvLOJYIc0k=; b=Jm8eljIl91ruqw/zzJrSOeeXteV9NR7SnVGW49CdkBSorog2KhplfENxc1wnzD+fyY Kt6mMRA4E+PFdinwL0mrirOlwEC0kTnni8rVpSymk1zdUvdX4mYp5O8zRh7NlQgJaPsd JZ0mzr+FWwKXlEK9PXaLpqBnHh1/gSI0YGk5Ggiby1Aca2M6HcmAs2DXVdCfL7b0lhnV fEneljHp1nEfy7dbKm/PPT4XAhqLjHR0OjuaveMCIb3eODqbSo9GxS8UW7vbAI3IfVfj wn4E8/8ABbZCXP3GyT2momX/L9IEeeDt4E3n/GHpxqodmYiyXc17Je8Djc/Nf4macGRS t9lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DpXQAJCk; 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 g26si1191716otk.324.2020.02.13.06.47.43; Thu, 13 Feb 2020 06:47:57 -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=DpXQAJCk; 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 S1727721AbgBMOrG (ORCPT + 99 others); Thu, 13 Feb 2020 09:47:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:58372 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727076AbgBMOrG (ORCPT ); Thu, 13 Feb 2020 09:47:06 -0500 Received: from localhost (unknown [106.201.58.38]) (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 5C7952073C; Thu, 13 Feb 2020 14:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581605226; bh=IJM+d8BHIo1ecjezWzI+cgzldKp7LTQuJBrLkNmTyE8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DpXQAJCk0y2hfgzNK2jmZ/1c3/l4bAoC0mUR/JVcUYOzi8W+WAlDiUrKsaixUt/Vu gfHgkE94J3Opo/IrVyCV1KaTjCpQmiJ+9nlZ2tgJMenOh91zP39K5w9HoJoNaDobvP 3eOdNNFovirzrozTAolV910odfKtmAkxBwCduEP0= Date: Thu, 13 Feb 2020 20:17:02 +0530 From: Vinod Koul To: "Gustavo A. R. Silva" Cc: Dan Williams , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] dmaengine: ti: omap-dma: Replace zero-length array with flexible-array member Message-ID: <20200213144702.GN2618@vkoul-mobl> References: <20200213003925.GA6906@embeddedor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200213003925.GA6906@embeddedor.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12-02-20, 18:39, 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] > > This issue was found with the help of Coccinelle. > > [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html > [2] https://github.com/KSPP/linux/issues/21 > [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Applied, thanks -- ~Vinod