From patchwork Mon Sep 26 21:49:04 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: 12989458 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 E7D81C6FA82 for ; Mon, 26 Sep 2022 21:49:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229591AbiIZVtP (ORCPT ); Mon, 26 Sep 2022 17:49:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230054AbiIZVtO (ORCPT ); Mon, 26 Sep 2022 17:49:14 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14809AF4B3; Mon, 26 Sep 2022 14:49:13 -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 sin.source.kernel.org (Postfix) with ESMTPS id 82F04CE13C2; Mon, 26 Sep 2022 21:49:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 863D0C433C1; Mon, 26 Sep 2022 21:49:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664228949; bh=c5mfyvzDdtpGvBZNQbXZ/taarYpntfkhxbA0y29pcg0=; h=Date:From:To:Cc:Subject:From; b=EqYLoFHjZB9GeNvg5n2j0bK9J6ES8kua1hp0Y4O/va9opVdpxZLsnlb6xsFdRCOZl jCzZNlrxwtVRg0gUTsSjbs3TzszokzPt3iAF6xIkgxFJwgCeck8YnmuMExrUEvYFJD rcDH7jGRj3ix9cf+F302oIGojrnthS6yPDftr8TlP27K88T6Uc2uk+5vVHyFgtAHNe VrjA6BcCdvrs12+LHCjK4+304y2xHpxv91nEjnk33B1RZnmNSgf18AAz0GO8U8Nqxl Cg+G3rGdiWBJQJ09RYvjL3hXJH5nqvPBuUlmrzq52Okm14PJgWh+PfnJeMgg3+cFcG zWwa0/HHp+fmQ== Date: Mon, 26 Sep 2022 16:49:04 -0500 From: "Gustavo A. R. Silva" To: Stanislav Yakovlev , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: 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] ipw2x00: 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 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/220 Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook --- drivers/net/wireless/intel/ipw2x00/ipw2200.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.h b/drivers/net/wireless/intel/ipw2x00/ipw2200.h index 55cac934f4ee..09ddd21608d4 100644 --- a/drivers/net/wireless/intel/ipw2x00/ipw2200.h +++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.h @@ -651,7 +651,7 @@ struct ipw_rx_notification { struct notif_link_deterioration link_deterioration; struct notif_calibration calibration; struct notif_noise noise; - u8 raw[0]; + DECLARE_FLEX_ARRAY(u8, raw); } u; } __packed;