From patchwork Mon Sep 26 21:41:54 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: 12989441 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 A3A49C6FA82 for ; Mon, 26 Sep 2022 21:42:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229902AbiIZVmE (ORCPT ); Mon, 26 Sep 2022 17:42:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229515AbiIZVmD (ORCPT ); Mon, 26 Sep 2022 17:42:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6465C72FCC; Mon, 26 Sep 2022 14:42:02 -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 AC5E66146C; Mon, 26 Sep 2022 21:42:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EA4FC433D6; Mon, 26 Sep 2022 21:41:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664228520; bh=Xa4BkxMFeIIJfKHYr4ePJYQZBBTMBlGFQ0Mb8GYffik=; h=Date:From:To:Cc:Subject:From; b=S6n/iFfWfO0akHLJkH4ZyqWVbWLfcz7qUaEqZPxOhUN/OHQ/zGk/ctEyX/E+Rb9Xd egpdAHEck9L41dnAlaOUBTfxfIuS3z/cs/0bstdYtRncPcUHXdwDJy99TDjNon38X/ tFGgpHiZC646p35urLUndeRicARWEwLDVzgyeVZyW5GdxSlUKf45LzePxy/dXLIzKw oIDzPb+uCJUZz7782eXeYjdgRCPZvfQO4OJyUJOsRc9eqLnm4RuXTgwTkoAAJ9As8U OCU85uUsSaY27/Hdlv7bORY8wEK/Ac//ApJDNBvON5qK/kRyzHHVgnYKHzgc+Bp4D/ mYnfeyFwEkP/g== Date: Mon, 26 Sep 2022 16:41:54 -0500 From: "Gustavo A. R. Silva" To: Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] ath10k: Replace zero-length arrays 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 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/212 Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook --- drivers/net/wireless/ath/ath10k/htt.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h index f06cf39204e2..c051a22fce14 100644 --- a/drivers/net/wireless/ath/ath10k/htt.h +++ b/drivers/net/wireless/ath/ath10k/htt.h @@ -1108,8 +1108,10 @@ struct htt_rx_in_ord_ind { u8 reserved; __le16 msdu_count; union { - struct htt_rx_in_ord_msdu_desc msdu_descs32[0]; - struct htt_rx_in_ord_msdu_desc_ext msdu_descs64[0]; + DECLARE_FLEX_ARRAY(struct htt_rx_in_ord_msdu_desc, + msdu_descs32); + DECLARE_FLEX_ARRAY(struct htt_rx_in_ord_msdu_desc_ext, + msdu_descs64); } __packed; } __packed;