From patchwork Wed May 24 02:12:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 13253214 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 2D913C7EE23 for ; Wed, 24 May 2023 02:12:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239011AbjEXCMH (ORCPT ); Tue, 23 May 2023 22:12:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236998AbjEXCMG (ORCPT ); Tue, 23 May 2023 22:12:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23507E48; Tue, 23 May 2023 19:11:56 -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 B4AF2637EF; Wed, 24 May 2023 02:11:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13B60C433D2; Wed, 24 May 2023 02:11:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684894315; bh=ciYnv1aFoGmFR4E+7iAdi4r/6ifLsJjIccdxEn4Wea8=; h=Date:From:To:Cc:Subject:From; b=DV34t2dY8RSLHh02ZTuPDRWPJ1LpnWMQ320RRABfgjwF/Vuf+AcGOvOEZxQV/3sg8 G2Cb5BziE0Nlc74a8DQpi2eU7G3Y27+3/Rctn8VM1PBPzryM2xaqA3S5AJHSFW62V9 f79v8ey3OcgdkleMit40QgRQcgcI6O15VHNipHz0Mjlw7Cfu2lg+2a00fL4Oc7ped0 E3DNZ/VWgCfUMdjoRrHxA64HVaHXc7rQuiBfhlVzd2b5e+/eUelcY2KJLRJAQxntXl f72UY+bDeXxsev8fxQZ6FfbetVlcC1Z8K3Yy3R+u81+O13TQ0ifpeqzSFA2dakLvua tjbFtI2AcgZzg== Date: Tue, 23 May 2023 20:12:46 -0600 From: "Gustavo A. R. Silva" To: Ping-Ke Shih , Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] wifi: rtw89: coex: Fix __write_overflow_field error Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-hardening@vger.kernel.org One-element arrays as fake flexible arrays are deprecated, and we are moving towards adopting C99 flexible-array members instead. Fix the following error seen under GCC-13 and -fstrict-flex-arrays=3: In function ‘fortify_memcpy_chk’, inlined from ‘_append_tdma’ at drivers/net/wireless/realtek/rtw89/coex.c:1579:3: include/linux/fortify-string.h:583:25: error: call to ‘__write_overflow_field’ declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning] 583 | __write_overflow_field(p_size_field, size); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy() and help us make progress towards globally enabling -fstrict-flex-arrays=3 [1]. This results in no differences in binary output. Link: https://github.com/KSPP/linux/issues/21 Link: https://github.com/KSPP/linux/issues/299 Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1] Signed-off-by: Gustavo A. R. Silva --- drivers/net/wireless/realtek/rtw89/coex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c index 3a586a971e8f..bda0e1e99a8c 100644 --- a/drivers/net/wireless/realtek/rtw89/coex.c +++ b/drivers/net/wireless/realtek/rtw89/coex.c @@ -206,7 +206,7 @@ static const struct rtw89_btc_ver rtw89_btc_ver_defs[] = { struct rtw89_btc_btf_tlv { u8 type; u8 len; - u8 val[1]; + u8 val[]; } __packed; enum btc_btf_set_report_en {