From patchwork Fri Mar 24 01:11:35 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: 74293 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp75490wrt; Thu, 23 Mar 2023 18:18:10 -0700 (PDT) X-Google-Smtp-Source: AK7set9GFMWQDNdSe147J3pWHkFGZnc7UmTZ3elDzcXi5Ar5cap6tsP4PP5/udlsUUUzMH3423xh X-Received: by 2002:a05:6a20:c10f:b0:d5:e2cb:6100 with SMTP id bh15-20020a056a20c10f00b000d5e2cb6100mr1382846pzb.49.1679620690356; Thu, 23 Mar 2023 18:18:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679620690; cv=none; d=google.com; s=arc-20160816; b=qBPd/S85oIksL2CT3e18ui5wiIHpv7w/LfSA5IwKZhgHvkzrZkmVq1HTE4faJmyFDO LitgPxp5ixMW/f+E/nC5TWALVjy8teielm74w01b+weeUohyJwUJ9ABNudxAGFEWr2nC ns9Tk1tspcWAjtRvOmgyvwbv3W6da/pfGxxysFzFsrZLVGwSzVYvTZKCqRqOlc8ZoE8m U7sS6qkvhCJKR0l+wxwK+pcaQ6uULmGEjLVIFGFMqizG1anJcxBV+fAT5X+GtR5LaOu2 2YXQuwjX23crdqF9aHOayGES7EZxU7JqZ+SOmyI8QwG1a4FM3HQc8gjMk7DC3eFjgFIG uCLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=KmD1hnu1xhKUCuZ14HpUb6IllLY8OBS2VfsSB0r/g8Q=; b=y/X2okk70zZxecEZV4gAB1SauUGniUzj5henIzM/sip1dhedo7lg79dbitrn9PedZi GjvUTzgw1aOHKsd169E0PuveQT5wc5ESHL0oQ9rQybzudE2aDPSbcDjTse+nBQRGTzyp gFWuQaAMBbT1HB+PCdJ1z3qdJoIbJiMNd6K1GcQQrbSsZ0LsvZGe6ZgsMtiIcPL4t320 isRAthZASMAhn+717+No5R9O7PqrHoskptfElDS6ewAhlr4ZUR8OdhwYseXJ6JYLSI7R k6oOCzTXIebKRcTdsWLKiuWX2JHboQrwo9mzYiEDwHExRyeTONrfVzu0FVGJYDn6CwPP VZ2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=svd0Lywy; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x22-20020a056a00189600b0062811212cb2si8891174pfh.367.2023.03.23.18.17.57; Thu, 23 Mar 2023 18:18:10 -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=svd0Lywy; 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 S230375AbjCXBLY (ORCPT + 99 others); Thu, 23 Mar 2023 21:11:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229499AbjCXBLX (ORCPT ); Thu, 23 Mar 2023 21:11:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B888C7DA0; Thu, 23 Mar 2023 18:11:17 -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 ams.source.kernel.org (Postfix) with ESMTPS id 710EBB822A6; Fri, 24 Mar 2023 01:11:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCDA7C433EF; Fri, 24 Mar 2023 01:11:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679620275; bh=jChlmGcZ3FGfnBX7fNnv8wDApgWT3zXUZGzW9tEgLMk=; h=Date:From:To:Cc:Subject:From; b=svd0LywyWL2ynnX0mBXIZ+kWSUnvdX6jm7Ev/vgd3F/0X+iiWYpuSzOLnw/l67D39 ONzuxTiQRAu087pglXu9ZvZT6AL4veh/hn5T3TG/3xbSWeqdZ0sdqEJpC18isQKAks PLd8jO0yTAm9VtkVelFWyXFL0z+3YVv5rjCjTdVHy0JJwdwUyo9YREvyl3k6fxxwGq z+mt71F9b1hkzSes4xs0YOu4qVoodWP+UrBLvQkOZmrL2o8yRvIShA1wkR+ri2T3kX /4Lddbz41FBbPIDwPxdRbO02aKv+8ZgXS1LXcKJTWd2m2hM8Pi1ZppufLJGgqeO0Zk Fn3cZz2iafeyg== Date: Thu, 23 Mar 2023 19:11:35 -0600 From: "Gustavo A. R. Silva" To: Ping-Ke Shih , 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] rtlwifi: Replace fake flex-array with flex-array member Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761209944709270970?= X-GMAIL-MSGID: =?utf-8?q?1761209944709270970?= Zero-length arrays as fake flexible arrays are deprecated and we are moving towards adopting C99 flexible-array members instead. Address the following warning found with GCC-13 and -fstrict-flex-arrays=3 enabled: In function ‘fortify_memset_chk’, inlined from ‘rtl_usb_probe’ at drivers/net/wireless/realtek/rtlwifi/usb.c:1044:2: ./include/linux/fortify-string.h:430:25: warning: call to ‘__write_overflow_field’ declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning] 430 | __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]. Link: https://github.com/KSPP/linux/issues/21 Link: https://github.com/KSPP/linux/issues/277 Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1] Signed-off-by: Gustavo A. R. Silva Reviewed-by: Simon Horman Acked-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtlwifi/wifi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h index 31f9e9e5c680..082af216760f 100644 --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h @@ -2831,7 +2831,7 @@ struct rtl_priv { * beyond this structure like: * rtl_pci_priv or rtl_usb_priv */ - u8 priv[0] __aligned(sizeof(void *)); + u8 priv[] __aligned(sizeof(void *)); }; #define rtl_priv(hw) (((struct rtl_priv *)(hw)->priv))