Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2028974rwb; Thu, 17 Nov 2022 05:44:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf7ZEk+ntbGv3rzEThhyBpS3HzWn9CHls1C8eBKsaDdwLdDDs3GLlv7tsy7RisRY2NoXM7u8 X-Received: by 2002:a17:906:4684:b0:7ad:a2ef:c62 with SMTP id a4-20020a170906468400b007ada2ef0c62mr2231448ejr.126.1668692674445; Thu, 17 Nov 2022 05:44:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668692674; cv=none; d=google.com; s=arc-20160816; b=iM6QNUrBqw2pWb3uc08TwY+eLDjI+UbHvpyO3p6OYlZ9V2q0ZpXgdNXs+b5OvkRtWI 14mLNczIi3g2YUfv6b6QlKpylesyK9MFydUFcDQGhjHPBzvLW5KtRDid7mEY0xitOzIF QjT/Fjd0x9u2zxCACZdKr9jl9YpdBGofuGSzLMkW6dwCPKQB91o9orgwZnBVbLXV0k7g ZbvUt5oLjOIuSTDXi5kk6nRqzmat5EfUZIg/FBFvTHwjZtb9xR2A8g5LO/1XHLpP8XZo NM6uTi3DNtONPkpAu/p5gJAIxVKUrgiJv7u/WffIJhuA1FYKsgPLGvwvEbAaDeAsimlU D+uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=OwQi3rxd/M0d8XMeLAsd4xYzmf6Wm9yo7zkKCJ58Ydo=; b=PqtCiW511faVd/waJEjvo8k558LBQU0TP+NiByjHtwZf8LW/ShjEnHS7gHWRsR0QHc 3WHQXRRcddtIym/AAh867uUtcTi9t8VC7ou+arJAXKO2cKgZiZoEJl7unx3kDdv5c24P GTJZZyQk59sEwjDfjNS37ilGOaXquMhx8Q26CRF34TgU7+VzKPXj0ncrG4aNux8kq4TD 7+eYvTOMYyFBJPHKcPHtLtF4amn1GANsW/EeinrtAS9sF3wZc5vfIwJF4iQhWtI1HA9u hSbyYUZRtkDwnN6RNi884TD0BXzMhvlQQqlDQmyvULfPfm2D3aDgiS0RVKJgkwu7RGvT MA+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b="Y/pQXmvA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w21-20020a05640234d500b0045d3ed38ae1si935921edc.16.2022.11.17.05.44.12; Thu, 17 Nov 2022 05:44:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b="Y/pQXmvA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239263AbiKQNVS (ORCPT + 92 others); Thu, 17 Nov 2022 08:21:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234870AbiKQNVQ (ORCPT ); Thu, 17 Nov 2022 08:21:16 -0500 Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25491558D for ; Thu, 17 Nov 2022 05:21:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1668691261; bh=N9pDZUTKVWmcCMLDo7BDwGJ71H9koLDvz0Lw4Lwo6pQ=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=Y/pQXmvAbDfPJC2BXP/MP7acs7sOO8XEv4QnGYFRLasTAsRNAVyOBPvWGFJboPdv1 bsdK/WJDPci3NIBO7bOMHQcuPGMO4G2btrPw0UAjmyCoE4XRmAvLb2nsmZX8Up38bq Cm9CZG8+rP84Ly+46oaOkiuzS1UilPVpLtBcPys4= Received: by b-6.in.mailobj.net [192.168.90.16] with ESMTP via ip-206.mailobj.net [213.182.55.206] Thu, 17 Nov 2022 14:21:00 +0100 (CET) X-EA-Auth: UijATNLUhksPhklMt0RnzdQPPKNk33NwzW2kr3ZK5xnRR3INQDOR1bX/0JRfebmWS/jsblxg8mESktDJkPEfVbXPwqGPnOpG Date: Thu, 17 Nov 2022 18:50:55 +0530 From: Deepak R Varma To: Greg Kroah-Hartman Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, gustavoars@kernel.org Subject: Re: [PATCH] staging: wlan-ng: Replace zero-length arrays with DECLARE_FLEX_ARRAY() helper Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 17, 2022 at 01:54:49PM +0100, Greg Kroah-Hartman wrote: > On Thu, Nov 17, 2022 at 03:48:45PM +0530, Deepak R Varma wrote: > > The code currently uses C90 standard extension based zero length arrays. > > The zero length array member also happens to be the only member of the > > structs. Such zero length array declarations are deprecated and the > > new C99 standard extension of flexible array declarations are to be > > used instead. > > > > The DECLARE_FLEX_ARRAY() helper allows for a flexible array member as > > the only member in a structure. Refer to these links [1], [2] for > > details. > > > > [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html > > [2] https://lkml.kernel.org/r/YxKY6O2hmdwNh8r8@work > > > > Issue identified using Coccinelle. > > > > Signed-off-by: Deepak R Varma > > --- > > > > Notes: > > 1. Proposed change is compile tested only. > > 2. Solution feedback from gustavoars@kernel.org > > > > > > drivers/staging/wlan-ng/hfa384x.h | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/staging/wlan-ng/hfa384x.h b/drivers/staging/wlan-ng/hfa384x.h > > index 0611e37df6ac..3a1edcb43e07 100644 > > --- a/drivers/staging/wlan-ng/hfa384x.h > > +++ b/drivers/staging/wlan-ng/hfa384x.h > > @@ -960,15 +960,15 @@ struct hfa384x_pdr_nicid { > > } __packed; > > > > struct hfa384x_pdr_refdac_measurements { > > - u16 value[0]; > > + DECLARE_FLEX_ARRAY(u16, value); > > } __packed; > > Why? This structure is never used anywhere, right? So why is this > needed to be changed and not just removed entirely? Same for the other > structures in this patch. Hello Greg, I am unable to confirm that these structures are truly not needed in the absence if a real device based testing. I could only validate that using the compile build and driver loading. This change that I am proposing in the interim would enable the compiler to protect the structure from addition of a new member below the zero length array. If there is a way to confirm that the structures are indeed not needed, I can revise the patch and send the cleanup accordingly. Please suggest. Thank you, ./drv > > thanks, > > greg k-h