Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp13364961rwl; Wed, 4 Jan 2023 07:14:12 -0800 (PST) X-Google-Smtp-Source: AMrXdXt6778oHoCAw0WqyitkQxTCug7eQCud33qzlimbjZ2yu+xpMBPj4UEJliTK1JUB6GlguErA X-Received: by 2002:a05:6402:2484:b0:46c:6ed1:83ac with SMTP id q4-20020a056402248400b0046c6ed183acmr44861551eda.9.1672845252497; Wed, 04 Jan 2023 07:14:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672845252; cv=none; d=google.com; s=arc-20160816; b=v3yTzPxazyra8Da62iIjWpmQ8mRKWoMnXvB1dd2y3QZQRPPyBm6WN89/UDj/OIS3S+ aNkopZJlko7swzqPHdbW6nISCUShgYP4LEeRJ7zmdUeGxntqgYAqO5TN8mEmNJsYD7eH uE0HNg/nilisfC7Q/gkmZvHMfohLT4F4TVt9UWSwrT2fVhCAQULdlrKYyjDHyRHjFsd8 erpDHw/VS9h70NQCBifykkK0gs2B4fmDvYM3loq9Pmkt6F9qsy6b9eoFQWPkhifHYhSY wOZWE7fvpSDn0sfCWmaZyUp440oDebBu+sUm4dA6Wh2n9zB494bciJac+uUdByBFZwgH PO3g== 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=LOmR8mJJs5s2uZFwI6ApEJCwOE3vOqCTQYRY2tENTdQ=; b=Ju7WdLhXrzecMYWuvkAMNc9iZygSSgftnmXOKbWKv1XhxSHn4rn0JrunEk/dCiTTlP T3zzjj3ZDGbDAImYP6dZ5KPHC3XHZJoTzzH+jD8NINqV1GK2ZXkWZkg1bRreteaHZ+r8 gQ8A6BMR+YGQTWPfAXWmuwzgQJ78jLl2qS7lSCTGCy9Wzn2dnLnhypCplJ2hcT4qCLzq 4g7JEP4luPZLOsy2501Xn9Edx2wgA3UCbdCP3zGKDI1Pdjj4UViJmNGIyorwN+m1nS/u kVaXDG4AdWZ92yojqeTXRAfFJfffm+SsgiYX6OalyRAZ+n7eEp87GkYRgsUzDlAt33kN igfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=nCKXozbQ; 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 v17-20020a056402349100b0046afd9f07b0si33986504edc.14.2023.01.04.07.13.58; Wed, 04 Jan 2023 07:14:12 -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=nCKXozbQ; 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 S229600AbjADPDJ (ORCPT + 57 others); Wed, 4 Jan 2023 10:03:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234797AbjADPDG (ORCPT ); Wed, 4 Jan 2023 10:03:06 -0500 Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB868A466 for ; Wed, 4 Jan 2023 07:03:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1672844561; bh=Gxx8p8mpsg9J44j8zqgcHN1uUXlyWdyKyrs6bhfzWxk=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=nCKXozbQ901kZvOchjH1D10FPAwM2IqGb1fn/ViN2k6hDV7thbPOMh5+U6HXTJeYt utDnNsTZQ1VxPgBpobrmh1MM4nU76m2Juy1w532D2O+D2UqfJuf2lGn7u7AJWNKrc3 LII0El9YhNLXA3D4jg80tp7lrgOs1MusTJa+oTqY= Received: by b-3.in.mailobj.net [192.168.90.13] with ESMTP via ip-206.mailobj.net [213.182.55.206] Wed, 4 Jan 2023 16:02:41 +0100 (CET) X-EA-Auth: ns1gYKoffHkdcXKgpzCMeK7t42qdBucUa46mVRkBNVeaeO+9qZ2eFPZ/rjcUQzgTjV+E5JIKm/U0moGyItmS6KukCk/RJckR Date: Wed, 4 Jan 2023 20:32:35 +0530 From: Deepak R Varma To: Alex Elder Cc: Johan Hovold , Alex Elder , Greg Kroah-Hartman , greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Saurabh Singh Sengar , Praveen Kumar , Deepak R Varma Subject: Re: [PATCH] staging: greybus: Replace zero-length array by 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 Wed, Jan 04, 2023 at 07:33:57AM -0600, Alex Elder wrote: > On 1/3/23 9:57 PM, Deepak R Varma wrote: > > The code currently uses C90 standard extension based zero length array > > struct which is now deprecated and the new C99 standard extension of > > flexible array declarations are to be used instead. Also, the macro > > DECLARE_FLEX_ARRAY() allows to use single flexible array member in a > > structure. Refer to these links [1], [2] for details. > > Thank you for citing some references in your commit, it's > a good and helpful practice. This might have been another > helpful one: > > https://lore.kernel.org/lkml/20210827163015.3141722-2-keescook@chromium.org/ Hello Alex, Thank you so much for the feedback. I will include the additional reference and send in a v2. > > > [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html > > [2] https://lkml.kernel.org/r/YxKY6O2hmdwNh8r8@work > > FYI, Linux mailing lists hosted by kernel.org are normally > cited using "lore.kernel.org" now, e.g.: > https://lore.kernel.org/lkml/YxKY6O2hmdwNh8r8@work > Your patch is fine, this is just so you can consider this > in the future. Sure, I will. This is very helpful to know. > > > Issue identified using Coccinelle flexible_array.cocci semantic patch. > > > > Signed-off-by: Deepak R Varma > > Looks good to me. Appreciate your time for the review and comments. I will include the reviewed by tag in my v2. Regards, ./drv > > Reviewed-by: Alex Elder > > > --- > > drivers/staging/greybus/usb.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/staging/greybus/usb.c b/drivers/staging/greybus/usb.c > > index 8e9d9d59a357..b7badf87a3f0 100644 > > --- a/drivers/staging/greybus/usb.c > > +++ b/drivers/staging/greybus/usb.c > > @@ -27,7 +27,7 @@ struct gb_usb_hub_control_request { > > }; > > > > struct gb_usb_hub_control_response { > > - u8 buf[0]; > > + DECLARE_FLEX_ARRAY(u8, buf); > > }; > > > > struct gb_usb_device { > > -- > > 2.34.1 > > > > > > >