Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp12744391rwl; Tue, 3 Jan 2023 20:41:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXtnInk4+voHSGRdzVBjG3qdRSALfceayFKuxPL3o0uZbcsleU6+kYGQtiXDoL2WxE/fr5gW X-Received: by 2002:a05:6a20:2a1c:b0:aa:7548:883d with SMTP id e28-20020a056a202a1c00b000aa7548883dmr49081376pzh.11.1672807281091; Tue, 03 Jan 2023 20:41:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672807281; cv=none; d=google.com; s=arc-20160816; b=HQ+3SFh6+OfX5dEdC5KyoZ4HGPXemQuF9rkfOVWgFTEUUUiYIeMsU/LAyhLSi4MzYK 6QNRzjKut3F3QvPLnGVEtr1wqzufjE9jm/Mp0eIHRB3cYbTNLOpVv/ITo5VigyaaiUOQ PiXmxRQF47KyNehYmuzu1F4oohRzSwdzq2J4qaCRthKfWAIW1W4vl4G5eTGvy55uEhtA QUNKZN7RF6GfRE49xFdJkN5z3EO1Ei8xvh9r+7CytwM3rDDxNVf335q2hVrH6VRmasIs M+VNTWbftwuS+jds0BUf3958bTMYoXJh9J8h6+LVyBqNLKJc5ZyCgByqdXZUSz4xq9gS ZmJQ== 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=M1BHEx2GjIbTZVAoegRfa6dB6VgyNCajqTT3OgMjW3s=; b=uPrlbCB4tHUiIMlg7ecwA5s4VLmnWosjpZgSgh4Uj5NV3ix+BMblvsmfhUo/D2+uJb I/zrs8yxmpox2HtWghOs3yXve3O6m5/3M0BThjKxLeMlxoag61fx3iZATzVs3ACFmv0w HIfrP00TWPuxMDLCEtwwlBoTlqbenr1yFqMXnredK5ETIUg/hlSyhJkaqsDnM7XP4nSq ZZiKWXK7tV0vqPniOSzPkc1wL2xsDrGyluzazF4/y4NoMlyAGaQssL5dLx8Oj2u2OQMb wpozlGdiJ81k8om9zmvE2N2ZK9vbzT2SWqM9jQQrcmLFd+C1CBLDf3djeAHmh+bT/zJR RMWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=mhmZWRg7; 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 f15-20020a17090a638f00b0021960920dc8si34767983pjj.53.2023.01.03.20.41.13; Tue, 03 Jan 2023 20:41:21 -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=mhmZWRg7; 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 S234334AbjADD6C (ORCPT + 57 others); Tue, 3 Jan 2023 22:58:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbjADD57 (ORCPT ); Tue, 3 Jan 2023 22:57:59 -0500 Received: from msg-1.mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79DE415725 for ; Tue, 3 Jan 2023 19:57:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1672804662; bh=g68WjsKLgm0BGTYxv3eXQb4GtGzcoRHUdOjEJjW3wxY=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=mhmZWRg7q9RRn1gaJqCAY8aA9wv7j52nQH+wxTIS3sijktduushce/wrRS2V2pS8d fDt+TJ2PCt4MRbhjE3a5XsNSTWUPxkvi7xJ/v9vhUF+pCZHEklAiE/+uKf/TNTBaZg Gw5kxjUfHUQdURs8gEz0XTDKWko6/iP1MWGyfnZs= Received: by b-5.in.mailobj.net [192.168.90.15] with ESMTP via ip-206.mailobj.net [213.182.55.206] Wed, 4 Jan 2023 04:57:42 +0100 (CET) X-EA-Auth: X/DPdo8+pBhmvVri8YvZq0puHGhoKFIrcwsvZGLQWmFtOckUnZf5FYyOYxYO9PtuPY2gUj2VwJjiahd9mMMg+B4hq+B0mD0m Date: Wed, 4 Jan 2023 09:27:37 +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] 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] for details. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://lkml.kernel.org/r/YxKY6O2hmdwNh8r8@work Issue identified using Coccinelle flexible_array.cocci semantic patch. Signed-off-by: Deepak R Varma --- 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