Received: by 2002:ac8:1418:0:b0:3ab:920c:4c8b with SMTP id k24csp5402490qtj; Wed, 4 Jan 2023 07:33:07 -0800 (PST) X-Google-Smtp-Source: AMrXdXu88zYb8VSWys9EopzkNLIYKw2CcZkrF7Skoxe2w97D+EdH+xPZd+9T7mZ55SnNWIS30yb1 X-Received: by 2002:a17:90a:f001:b0:226:6055:776f with SMTP id bt1-20020a17090af00100b002266055776fmr13998455pjb.32.1672846387628; Wed, 04 Jan 2023 07:33:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672846387; cv=none; d=google.com; s=arc-20160816; b=ahLiOFt6JVu9zofYBloXF0NAZBJUkFxvYw6GaNItWae++3Gh5m3jLWRr+9OAisTzlg D1HZeT42p8EEjI3Jq9inJB0BVz7ST0Mf4Bw2J4TL1+1QpBfWMNILWhWQXiE4GoFjlw51 KmO4ou+M0CDlgdDkkkWrqZrDkwdKXWx4kaydXK80Pbhrq8i3hjmZZmQPlXoA+mXdI50J ypcEPlab/p29PfSNLIYM+Kz8AYOYAqFu5vBS9nj7beDN/PHvpJwHWrXCF/Ig8naKVPjU LTMlfoqk6DSv+DjxXQC4sLjK6lP0HSQUqWZFlHzhAEltTt0iMlcjhaieAPB/Va76rjKe 3YfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=dvzpRORGS0LqgPxB27LbAA3EDYWqJhxX8PbY2NX0HdY=; b=bfJuzXJBTicBY2KeRrIYX1hW4Hz51e9NEVZAK4sCoPTzxKethgQRxuJwiLv9Oc56PT Hl/eU6u0KyQODSUf+EYNXe24R2FqHUSVNRUOkz/KAdK8nrEdkvY9CxMFseus468qjDOF nplro3l9RM/1BvSNOn+O/mLAugpwTSlYeurWUgTe9fEZz9oMoSJW7nkT3fFNPPyxtN4c gd1K6yJCJp4WTwqvPorGT5P+xMKnv1rCMO0FT1S/N+sgk51j8h3S0TmHzO7VzzsaQYi2 /UxBhYamUsEFAVEWYAlCyAywQLUbX1ahoigr12fD+3vXWyk/YsuhiMjfmVa1sSNsVitV yhQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=N39HXlk0; 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 pg13-20020a17090b1e0d00b0022335a67eb9si15769614pjb.175.2023.01.04.07.32.59; Wed, 04 Jan 2023 07:33:07 -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=N39HXlk0; 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 S239485AbjADPVC (ORCPT + 57 others); Wed, 4 Jan 2023 10:21:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239603AbjADPUe (ORCPT ); Wed, 4 Jan 2023 10:20:34 -0500 Received: from msg-1.mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C34B41D66 for ; Wed, 4 Jan 2023 07:19:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1672845524; bh=4WpdPESN9laCQ+0dJmH7VyKj6Z31XLjyfTH0r5nSp8Q=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=N39HXlk0W+MGAQ5rlz8fsuFhKA54WDmJbAWuLnco2QEA0v6Tab5DUGNbT7qKkXMie aU5t/1sd6JcxZXgFXxZNsPiQcTneG5afojH2hApZrhdHFcpbiTA6ekoPSFYWTi3ldC C06SrGMstJip6vnTTLtM15bXg1PaOh+HnTF86XsE= Received: by b-6.in.mailobj.net [192.168.90.16] with ESMTP via ip-206.mailobj.net [213.182.55.206] Wed, 4 Jan 2023 16:18:44 +0100 (CET) X-EA-Auth: 3o+1Ih6VxbOMPaGorsbD5/WgdCd+p/k8N8ulKnPs8eMqVrMW1/0ry1vYlZ+tKsz7zkpeAryF9JTQ4DZa68X2NjxW1nx+DONI Date: Wed, 4 Jan 2023 20:48:38 +0530 From: Deepak R Varma To: Johan Hovold , Alex Elder , Greg Kroah-Hartman , greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar , Deepak R Varma Subject: [PATCH v2] staging: greybus: Replace zero-length array by DECLARE_FLEX_ARRAY() helper Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 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], and [3] for details. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://lore.kernel.org/lkml/YxKY6O2hmdwNh8r8@work [3] https://lore.kernel.org/lkml/20210827163015.3141722-2-keescook@chromium.org/ Issue identified using Coccinelle flexible_array.cocci semantic patch. Signed-off-by: Deepak R Varma Reviewed-by: Alex Elder --- Changes in v2: Following improvements as suggested by Alex Elder - Include third reference URL in the commit message. - Update 2nd reference URL - Include Reviewed by tag 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