Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5855961ybv; Wed, 12 Feb 2020 01:22:44 -0800 (PST) X-Google-Smtp-Source: APXvYqxxx9me18Rcy3bzkZ8JkRKeby2di7ruR98P/vTI4EKTXeDTZnsFgnHa8WdfvGUlEqfEMON7 X-Received: by 2002:aca:acc4:: with SMTP id v187mr5677883oie.130.1581499364728; Wed, 12 Feb 2020 01:22:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581499364; cv=none; d=google.com; s=arc-20160816; b=FEeXvDjfCGhRX9JryPrtsIUEuL4mM0E9cf22aM2O7qP4md+gh7DRUCsbQHvzcLXrvf bWFwBKdr0HfwZxVHXjWIWgIAKJr/NNglhB0JlEFil3j/o5wUpW/GtSGUFLPy8NHzihiy yIpf6Uni3yQCti4Vg7LCW4PiJqIiwZqBBmvsqnQPZsR2bJb8cZF3V2q+Pm2xv4fCxm0m XMkY5yKyi2kLLAkLHPuZUqm8n8EhVyK8uxvX8zqxjM/mPlGiSrZEvGd3yh/AM8Px108H jacvdEo0Da+kQ2mgA3OaK/A0tCYI0pZijS25XSY/ngEP5LtvmFkysGWBTpF9qOM3HqND Mocw== 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:dkim-signature; bh=8HhGU6yaLOtpr5hOSd5iA2lPFMINYOyqL+TaAgpB1Fg=; b=HCv9y9aZqVNS9bKgpQxjwucQ6IaQcplwTTVBbSbPDcTP39Z79/C7WFQtbAk695akLU TpUMkYlxJ57qdDjlwVg0MhcloMBYhvBM+cMorrqya1aEaEaBiw5L9q8PhTKPBzEiuaKp lSWs6McT6d4dum8gcPMI6/k6FvhTsDvrV5BuwGwCA4Bc5ZuUdbA8q/cSFmTT2iBsRt5e 1VqnEh109GSDUkGkKFxWkag/GrTkDZ9B4f3T6h3GAaHa2Qw9QOvB2Z2bnvihWPptbtR7 447KH0c/HJmWiN+v9A5nubnnV9l7uH941crO3ROzIw0NKP+N/We9Hm6HwONI+khHrITV RRxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=l4APu5AT; 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=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10si3295919otn.122.2020.02.12.01.22.32; Wed, 12 Feb 2020 01:22:44 -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=@cirrus.com header.s=PODMain02222019 header.b=l4APu5AT; 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=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728698AbgBLJV2 (ORCPT + 99 others); Wed, 12 Feb 2020 04:21:28 -0500 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:33624 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728530AbgBLJV1 (ORCPT ); Wed, 12 Feb 2020 04:21:27 -0500 Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01C9CMd7030569; Wed, 12 Feb 2020 03:20:32 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=PODMain02222019; bh=8HhGU6yaLOtpr5hOSd5iA2lPFMINYOyqL+TaAgpB1Fg=; b=l4APu5AT6ALyNG3zEI22OUCvYGlvSEqhltargsGgNtZ33SQExwhsfGc2MyR9isW9Ad2w ArXbXNdXwVWxElXK7Uftoo6zCEIpVpWuDoQSAy2In3ORV+NVCKt9O4s4bQhVnKYJfYBE bKbjHB0suxwNCuDlGfFvfNXCnRCi0VALGdYX0Futh0A80W0KDJWw2ZOc/eUBSxwky/A+ icGQntcFCVurtnrSjCHoOytB5d0nR8oow3s9AgSVwkjrZQNvysbZSYTU5WVnExT1vvcP I9K4xXvmtW9E3YTTKjQ/NxYfjzaAZo0pVT8+caPmV41AQz1g+3x10UqUp1AV6APmWnYX Ww== Authentication-Results: ppops.net; spf=fail smtp.mailfrom=ckeepax@opensource.cirrus.com Received: from ediex02.ad.cirrus.com ([5.172.152.52]) by mx0b-001ae601.pphosted.com with ESMTP id 2y1ta165f0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 12 Feb 2020 03:20:32 -0600 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1591.10; Wed, 12 Feb 2020 09:20:30 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.1591.10 via Frontend Transport; Wed, 12 Feb 2020 09:20:30 +0000 Received: from ediswmail.ad.cirrus.com (ediswmail.ad.cirrus.com [198.61.86.93]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 6C9A72AB; Wed, 12 Feb 2020 09:20:30 +0000 (UTC) Date: Wed, 12 Feb 2020 09:20:30 +0000 From: Charles Keepax To: "Gustavo A. R. Silva" CC: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , , , Subject: Re: [PATCH] ASoC: wm0010: Replace zero-length array with flexible-array member Message-ID: <20200212092030.GE4098@ediswmail.ad.cirrus.com> References: <20200211200549.GA12072@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20200211200549.GA12072@embeddedor> User-Agent: Mutt/1.5.21 (2010-09-15) X-Proofpoint-SPF-Result: fail X-Proofpoint-SPF-Record: v=spf1 include:spf-001ae601.pphosted.com include:spf.protection.outlook.com -all X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 spamscore=0 impostorscore=0 mlxlogscore=755 adultscore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002120075 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 11, 2020 at 02:05:49PM -0600, 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 > inadvertenly introduced[3] to the codebase from now on. > > 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") > > Signed-off-by: Gustavo A. R. Silva > --- Acked-by: Charles Keepax Thanks, Charles