Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp70672rwb; Mon, 26 Sep 2022 14:57:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Q7n8QFYiL+7v/06RRtYmZYwZrI1DlfQV7p6JckUjpKgseQZlYzt+N6H9Do78JOTCNHjXh X-Received: by 2002:a17:90b:4d0d:b0:1fb:a86d:e752 with SMTP id mw13-20020a17090b4d0d00b001fba86de752mr909621pjb.120.1664229478542; Mon, 26 Sep 2022 14:57:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664229478; cv=none; d=google.com; s=arc-20160816; b=s6JNog69oEvJBxEtrUCx3qZM+jPvIGz/seGDbkxuFxyJHZ5TbOy90VGC7mPNyEu/hY p+y3JtB7qCDPbDchttdRp1K4jqMLMqmGGc9CAY+d3o5hyEdY4hj9Y2AnV+AoiNhKgly1 jdrggSE5iPQrMZOoFMAN1rIjaLQYZ3ekHupxHVTM6hBOGC+4AWaXNDOjZbYl0d+a5m0f ul4roEeSDNAldALnEtmtXOpolUMKdaXfUEc1vaikGuQiFQzyj6KCN2CZxcjXdiT4TFn3 gEanpmojJQxmczmAMFJHqCamQuDwgRPUhsPaJSeamK9m+E0k4qtpO12jeu9z416utAQi ub8A== 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=tdoZIli0jwO3K5zuGp8AlaiVIllbO21D6O0Lh85hRg0=; b=RkkKfP852yxjR6b3nIUy5MfyC8w8PImQmSLc10B1/oM5hVhw+g7sBb7RmdzG23+bsS LMGTk1syLUpO5PjiGlaOJNv9bBJnJnGFefVLRUephKbCzdPpLh6ufev5YBot8ZCNJkgp QZV5tkB1EtdysTvdQW5JuNt0THdF1/qs+5YpGHytPswr5WoLA5G46MCUZEKV5DsrDawN BEUcBXZ9cXsBZLz60naAAQ79JULncRmXqm6XRYr41zzoFk+Ioix0dNWW1DJz1bh6bh48 jv3V8xylHf6GsvAwYUSjQm9Gz1wqjgmTLhcaH5ViB4PaQ8qnQYvbK37dBUSWAaei3U/g NB0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dHWzkwPf; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q27-20020a63751b000000b0042b9117b723si23470996pgc.794.2022.09.26.14.57.45; Mon, 26 Sep 2022 14:57:58 -0700 (PDT) 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=pass header.i=@kernel.org header.s=k20201202 header.b=dHWzkwPf; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229951AbiIZVoF (ORCPT + 99 others); Mon, 26 Sep 2022 17:44:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229559AbiIZVoE (ORCPT ); Mon, 26 Sep 2022 17:44:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27277A260B; Mon, 26 Sep 2022 14:44:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B5E4C61387; Mon, 26 Sep 2022 21:44:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB347C433D6; Mon, 26 Sep 2022 21:43:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664228642; bh=l/lWJrT4cHiOPDK7ygIeGv7vATX25bNh8bpEBLU1M/w=; h=Date:From:To:Cc:Subject:From; b=dHWzkwPfoc2i2YpAkIG5D2BDig+nx/fYd4f/IQrpYPFIpvruiuOk81hfIKJkGwdEL Pyg3Oa3zG8VIvPBQDALhZ8OkDPekTW9kcFGK3xWmwsQdwOjkz775V7bSDkOuOmAIH1 EL92Jut+cMYQUBRd8UgjrCbQSZ6eBP6naEC9dd/2h15dF8S11kUeqIShFtQMV/ftxy wu9ijQqg6HdX0J6UTL6zQudoK2brincVUaAeuIgj12CpY9rOBOljabLrUftrFShKkJ 0NyEjF605JhLBX7RFBd0CocLPP1BOdDhOCaJoQdfdAj7oy9+pZ0wDl72NINYMDo8KE dPyIesWa6qtcg== Date: Mon, 26 Sep 2022 16:43:56 -0500 From: "Gustavo A. R. Silva" To: Wolfgang Grandegger , Marc Kleine-Budde , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] can: ucan: Replace zero-length array with 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=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Zero-length arrays are deprecated and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length arrays declarations in anonymous union with the new DECLARE_FLEX_ARRAY() helper macro. This helper allows for flexible-array members in unions. Link: https://github.com/KSPP/linux/issues/193 Link: https://github.com/KSPP/linux/issues/214 Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html Signed-off-by: Gustavo A. R. Silva --- drivers/net/can/usb/ucan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/usb/ucan.c b/drivers/net/can/usb/ucan.c index 7c35f50fda4e..b53e709943bc 100644 --- a/drivers/net/can/usb/ucan.c +++ b/drivers/net/can/usb/ucan.c @@ -245,7 +245,8 @@ struct ucan_message_in { /* CAN transmission complete * (type == UCAN_IN_TX_COMPLETE) */ - struct ucan_tx_complete_entry_t can_tx_complete_msg[0]; + DECLARE_FLEX_ARRAY(struct ucan_tx_complete_entry_t, + can_tx_complete_msg); } __aligned(0x4) msg; } __packed __aligned(0x4); -- 2.34.1