Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2012793ybh; Tue, 14 Jul 2020 13:09:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1Lk6IZDX/8Awb66XqSmwgd2+dXBj7eG43feHFBc8bRdFgrBUGq9FvWJHD4ncbUfCWrw0+ X-Received: by 2002:a17:906:f298:: with SMTP id gu24mr6079269ejb.302.1594757341759; Tue, 14 Jul 2020 13:09:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594757341; cv=none; d=google.com; s=arc-20160816; b=rfIHReWMFRa6l60c1gGdocgJXkzIV3cpN57I+OeRjF0QjSq8mfZT+dfFU+y6xh6gDH KMl4DlGjkEZ0WuknuTntSzs65rRH96vH1Q2LGJEDWCD4gxdPHPh2Hj41hc36RNrl71h8 2yHXdLRiQkhjFNacvOALRSfWE1yNz8tVEJ19ZtoBGfz1Uz8nLJo+h6YAUd5So2aw933G T+FbnNEuOjcztoO83LEwdsZagYA06RV3bdx8lwYktYX+6Vt5F+Fh3r4pNUMN6tD1m2fx /DzHmPqfPebhoPuEg663g/Z8NmoA5Gh4Ed73HN1BnbVfYTB4rt5b+OvXmCy1N0goqzdw mTtQ== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=gRF7cpogd9Fax5WhMlg3pfO96EFF+taH4e4Pu+B3s8Y=; b=KpyKOluWxlq2LpOcIm8NG2TnAYWDnSoX76yjO/nL+4OpugXghWJctve2kaFDwWwdE7 nk7dVKeLMRdunjmh7m6og/nXeJ7YqumPmfaE72UFZArq6XD06psx8rkFwOq6f/0O9m9m su2D6anwZH3S/CD8TKLWnD/uT71IqhqK0cA0Bl9NdwHbhqf+S0X3TZpxr/HtLYPsCmSb LzCeWA4nvByFXdGSPOfRLebidfn2+Q8hK7urbvkdmQaAE2/xzRCmttyl5B2+sOyPrKJv 8tghiMKoMHMtPNcDSfTuqxoVzpKJUVD8ARxuivehcTyLhRZ/yKdwfVg7PpGiujAf47xp bCow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2jLxk+PH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id cw24si10823169edb.177.2020.07.14.13.08.38; Tue, 14 Jul 2020 13:09:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2jLxk+PH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1730116AbgGNUHy (ORCPT + 99 others); Tue, 14 Jul 2020 16:07:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:38796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729442AbgGNUHx (ORCPT ); Tue, 14 Jul 2020 16:07:53 -0400 Received: from embeddedor (unknown [201.162.240.73]) (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 BFC4320720; Tue, 14 Jul 2020 20:07:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594757273; bh=ygYbAYLGtGi7VTNZOTi8yA86zw5Ek9sxpF/WVqk+Yn8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=2jLxk+PHM89Y7wfEZBVvTrSPCdxreCNs0ELZdOLeAZOFolpHFxcZ7/g2T5+ujmcxy oxjwBxxgR3qY2BNocFAGQa75DXj7xGFS0txlKfRADEE7cI7yj8so/OPwGF7s3QCbGU 4ursNvzTIFslQ+CI4mAUqFzS0q+1qSepYkx7g3Sg= Date: Tue, 14 Jul 2020 15:13:24 -0500 From: "Gustavo A. R. Silva" To: "Winkler, Tomas" Cc: Arnd Bergmann , Greg Kroah-Hartman , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH][next] mei: Avoid the use of one-element arrays Message-ID: <20200714201324.GA31673@embeddedor> References: <20200714174644.GA30158@embeddedor> <20200714180855.GA31158@embeddedor> <32f85e185c2244a19a1705d0db315c69@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <32f85e185c2244a19a1705d0db315c69@intel.com> 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 Tue, Jul 14, 2020 at 07:57:51PM +0000, Winkler, Tomas wrote: > > > > On Tue, Jul 14, 2020 at 05:54:32PM +0000, Winkler, Tomas wrote: > > > > > > > > There is a regular need in the kernel to provide a way to declare > > > > having a dynamically sized set of trailing elements in a structure. > > > > Kernel code should always use “flexible array members”[1] for these > > > > cases or, as in this particular case, replace the one-element array > > > > with a simple value type u8 reserved once this is just a placeholder > > > > for alignment. The older style of one-element or zero-length arrays > > should no longer be used[2]. > > > > > > > > Also, while there, use the preferred form for passing a size of a struct. > > > > The alternative form where struct name is spelled out hurts > > > > readability and introduces an opportunity for a bug when the > > > > variable type is changed but the corresponding sizeof that is passed as > > argument is not. > > > > > > > > [1] https://en.wikipedia.org/wiki/Flexible_array_member > > > > [2] https://github.com/KSPP/linux/issues/79 > > > > > > > > Signed-off-by: Gustavo A. R. Silva > > > I'm okay with the patch but in this case the description is a bit off. > > > In this case there was no intention for a flexible arrays its just a reserved > > field. > > > > > > > The reserved field is actually mentioned in the description: > > > > "... or, as in this particular case, replace the one-element array with a simple > > value type u8 reserved once this is just a placeholder for alignment." > > Right, but it looks not connected to overall context, it looks like not very clean reuse of a commit message. > I would say that this reserved[1] rather had confused the detection scripts you are using for the cleanup you are doing. > Again, I'm okay with the patch, but if you can reword the commit message it would be even more okay. > Yep; I've come up with a more concise text for these sorts of cases: "One-element arrays are being deprecated[1]. Replace the one-element array with a simple value type u8 reserved, once this is just a placeholder for alignment. [1] https://github.com/KSPP/linux/issues/79" I'll send v2 with the text above, shortly. Thanks for the feedback. -- Gustavo