From patchwork Mon Aug 29 21:50:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 12958493 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43446ECAAD4 for ; Mon, 29 Aug 2022 21:51:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229552AbiH2VvJ (ORCPT ); Mon, 29 Aug 2022 17:51:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbiH2VvI (ORCPT ); Mon, 29 Aug 2022 17:51:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 418A37CB49; Mon, 29 Aug 2022 14:51:06 -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 D3A96611B8; Mon, 29 Aug 2022 21:51:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4834C433D7; Mon, 29 Aug 2022 21:51:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661809865; bh=fXRYrMEM8Kk9+epg4G5pFtUERqSSGU8XuYoO6vErhkM=; h=Date:From:To:Cc:Subject:From; b=SWAzvLQHq6MKKoZVJQRmwywvjem5AjdbGmOtmsa8n4SdUSrwzoKWS04r1Q7uzGnAp e2Nocsr45XUJtOl78NNUowJa74WDxeB242k9Sx2Unu76qCw1sDOHMpirZWfXRaGaBT mkXvf1D4Hw/Yjyz5WRG394hiET42VHptEduU+2UokaFstMkjo84qCBT/AyeiJ0Osa/ oPZzRWiI3ZQHnUoDC57GZw9AP1xmgUAPPwFB5nfg1zV6zUftGjHgXfDBzTm4KlWCPQ 4IRP51HBalW+LP0mnJ6G1TFTzGkpNs9vuZcO/VEzTAoJdSgS5KOHPG3Zw4ggPjlWq5 b2aFUnLyiL+dQ== Date: Mon, 29 Aug 2022 16:50:59 -0500 From: "Gustavo A. R. Silva" To: Vincent Mailhol , 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: etas_es58x: Replace zero-length array with DECLARE_FLEX_ARRAY() helper Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-hardening@vger.kernel.org Zero-length arrays are deprecated and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length array declaration in union es58x_urb_cmd with the new DECLARE_FLEX_ARRAY() helper macro. This helper allows for a flexible-array member in a union. Link: https://github.com/KSPP/linux/issues/193 Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook Acked-by: Vincent Mailhol --- drivers/net/can/usb/etas_es58x/es58x_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.h b/drivers/net/can/usb/etas_es58x/es58x_core.h index d769bdf740b7..640fe0a1df63 100644 --- a/drivers/net/can/usb/etas_es58x/es58x_core.h +++ b/drivers/net/can/usb/etas_es58x/es58x_core.h @@ -222,7 +222,7 @@ union es58x_urb_cmd { u8 cmd_type; u8 cmd_id; } __packed; - u8 raw_cmd[0]; + DECLARE_FLEX_ARRAY(u8, raw_cmd); }; /**