From patchwork Tue Jun 13 14:09:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 13278872 X-Patchwork-Delegate: kvalo@adurom.com 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 52977EB64D7 for ; Tue, 13 Jun 2023 14:11:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242674AbjFMOLD (ORCPT ); Tue, 13 Jun 2023 10:11:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242738AbjFMOJn (ORCPT ); Tue, 13 Jun 2023 10:09:43 -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 4F6DC1BC3 for ; Tue, 13 Jun 2023 07:09:23 -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 3EE9962DCF for ; Tue, 13 Jun 2023 14:09:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49B7FC433D9 for ; Tue, 13 Jun 2023 14:09:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686665361; bh=NFbjDPlRqQu+fn9/WqwxeIA8pjAggPFRDv1uv5ut/so=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZkKe7pBhOhsITcWoW6ESgjLBchu3M6YrizPpBNcm4KnU7CV2lh68TZ01GfmZqJJvy 81lYgeGY10P64J95rag9GZTmzufvp6Orftm+hDvr7QiM3EHP5Tx/PhrCNIjtFnQ4rp C3YqrJBbUM3Zqiu/usbdljFUl+gQJtKmKkavNFleyoY0HvpnP7j/8lTY7ILThSy1nN 0XQly28lbO9bPx+6ab0hBduH0FHzdOnnnAH12FsDjsKEJL6Q41CuSR+JlrTSxfxFaf +2+AitTuu1A/jTQXgBA5/nbA0EbPOMndPHSyZ2h8zrnL9ZK0ICj8J7epnfLtp16IOb 7MtftWrn5+Tig== From: Kalle Valo To: linux-wireless@vger.kernel.org Subject: [PATCH 1/4] wifi: brcmfmac: fix gnu_printf warnings Date: Tue, 13 Jun 2023 17:09:15 +0300 Message-Id: <20230613140918.389690-2-kvalo@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230613140918.389690-1-kvalo@kernel.org> References: <20230613140918.389690-1-kvalo@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org With GCC 13.1 and W=1 brcmfmac has warnings like this: ./include/trace/perf.h:26:16: warning: function 'perf_trace_brcmf_dbg' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] Add a workaround which disables -Wsuggest-attribute=format in tracepoint.h. I see similar workarounds in other drivers as well. Compile tested only. Signed-off-by: Kalle Valo --- .../net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.h index 5a139d7ed47a..5d66e94c806d 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.h @@ -28,6 +28,11 @@ static inline void trace_ ## name(proto) {} #define MAX_MSG_LEN 100 +#pragma GCC diagnostic push +#ifndef __clang__ +#pragma GCC diagnostic ignored "-Wsuggest-attribute=format" +#endif + TRACE_EVENT(brcmf_err, TP_PROTO(const char *func, struct va_format *vaf), TP_ARGS(func, vaf), @@ -123,6 +128,8 @@ TRACE_EVENT(brcmf_sdpcm_hdr, __entry->len, ((u8 *)__get_dynamic_array(hdr))[4]) ); +#pragma GCC diagnostic pop + #ifdef CONFIG_BRCM_TRACING #undef TRACE_INCLUDE_PATH From patchwork Tue Jun 13 14:09:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 13278873 X-Patchwork-Delegate: kvalo@adurom.com 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 4D4CEEB64D8 for ; Tue, 13 Jun 2023 14:11:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242561AbjFMOLF (ORCPT ); Tue, 13 Jun 2023 10:11:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242865AbjFMOJq (ORCPT ); Tue, 13 Jun 2023 10:09:46 -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 CF8DD1BD0 for ; Tue, 13 Jun 2023 07:09:24 -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 5EEA662BF4 for ; Tue, 13 Jun 2023 14:09:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FABFC433F1 for ; Tue, 13 Jun 2023 14:09:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686665362; bh=HGUJPj8Zb2nczOTlJUfhU7bQeSCQyXzXYC+YrzNKh3g=; h=From:To:Subject:Date:In-Reply-To:References:From; b=EMYHYbGB0ylaYfz4/EMBU7qI/7X8I7rxvBN0QkgxknuHOm04rMqExjwsW68ooKdLb YTOGSoO3ehGIrLL6bE99tNhiT5kF4pSlwXd0e+5bF7Rt7v6lzLBtGfoFs+zBbHFDBo PaqMJ/5v1C/H3VYqewWpPZizF2bAf5WbrmRpWwIIfVctdQ6fSFIAKcsoOKMur9wogb Y5ahfHVqpWrAE8bFx+DUlnNh/p4x5+1fyVpb6AEQsu//lasLhm0iWlVnc+Urw6wYBY cjHT4BK1RJ+fsE1Iu4I5osfTNNjpjyTcaxlsML92NqPaDDNsW4Y+ZqjSLfnK7pmqMr FrOQwhjoqYI3w== From: Kalle Valo To: linux-wireless@vger.kernel.org Subject: [PATCH 2/4] wifi: brcmsmac: fix gnu_printf warnings Date: Tue, 13 Jun 2023 17:09:16 +0300 Message-Id: <20230613140918.389690-3-kvalo@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230613140918.389690-1-kvalo@kernel.org> References: <20230613140918.389690-1-kvalo@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org With GCC 13.1 and W=1 brcmsmac has warnings like this: ./include/trace/stages/stage5_get_offsets.h:23:31: warning: function 'trace_event_get_offsets_brcms_dbg' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] Add a workaround which disables -Wsuggest-attribute=format in brcms_trace_brcmsmac_msg.h. I see similar workarounds in other drivers as well. Compile tested only. Signed-off-by: Kalle Valo --- .../brcm80211/brcmsmac/brcms_trace_brcmsmac_msg.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcms_trace_brcmsmac_msg.h b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcms_trace_brcmsmac_msg.h index 488456420353..42b0a91656c4 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcms_trace_brcmsmac_msg.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/brcms_trace_brcmsmac_msg.h @@ -24,6 +24,11 @@ #define MAX_MSG_LEN 100 +#pragma GCC diagnostic push +#ifndef __clang__ +#pragma GCC diagnostic ignored "-Wsuggest-attribute=format" +#endif + DECLARE_EVENT_CLASS(brcms_msg_event, TP_PROTO(struct va_format *vaf), TP_ARGS(vaf), @@ -71,6 +76,9 @@ TRACE_EVENT(brcms_dbg, ), TP_printk("%s: %s", __get_str(func), __get_str(msg)) ); + +#pragma GCC diagnostic pop + #endif /* __TRACE_BRCMSMAC_MSG_H */ #ifdef CONFIG_BRCM_TRACING From patchwork Tue Jun 13 14:09:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 13278870 X-Patchwork-Delegate: kvalo@adurom.com 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 3E7E8EB64D0 for ; Tue, 13 Jun 2023 14:11:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242773AbjFMOKx (ORCPT ); Tue, 13 Jun 2023 10:10:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242895AbjFMOJx (ORCPT ); Tue, 13 Jun 2023 10:09:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB6021BE5 for ; Tue, 13 Jun 2023 07:09:27 -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 78CBC635E7 for ; Tue, 13 Jun 2023 14:09:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 558A2C433F0 for ; Tue, 13 Jun 2023 14:09:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686665363; bh=uqczZrDZXEPNGEqebmyy1y70gdSr30LkBaW8pslQQVg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=BW0Q/kgWBltboi+xnIJPTdZc7j0ew2E+VxY5tFpI96WKE4XwkhvyPGv5rxMuz5Gmh ny1bkH/mmVlER4G3vFO+kSnNWLGb+BVDsVwpuB+9uxQVrE4jLNyaWrmDo3WPm4veYR 3SMDwrvVmWE/eEAUKCd1q86pG7LxVI4R+7mlITfzg+AU59Ab7+qSmezTAYk+cZoEx7 CkXBylPkEqH5yi7VXu9V/c3rZDAruZdIB0asceHbzBzWfnP/KlYMnCPIChBeKRLZni EsRtgM1kto7+P6BG0sNeqVAmJnT15kbywO2Vda7O/LSFf5ne+ig2sqnhA8lo6mUdcL H1xu16mkcyIqg== From: Kalle Valo To: linux-wireless@vger.kernel.org Subject: [PATCH 3/4] wifi: hostap: fix stringop-truncations GCC warning Date: Tue, 13 Jun 2023 17:09:17 +0300 Message-Id: <20230613140918.389690-4-kvalo@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230613140918.389690-1-kvalo@kernel.org> References: <20230613140918.389690-1-kvalo@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org With GCC 13.1 and W=1 hostap has a warning: drivers/net/wireless/intersil/hostap/hostap_ioctl.c:3633:17: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation] fortify-string.h recommends not to use strncpy() so use strscpy() which fixes the warning. Also now it's guarenteed that the string is NUL-terminated. Compile tested only. Signed-off-by: Kalle Valo --- drivers/net/wireless/intersil/hostap/hostap_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/intersil/hostap/hostap_ioctl.c b/drivers/net/wireless/intersil/hostap/hostap_ioctl.c index 26287b129d18..b4adfc190ae8 100644 --- a/drivers/net/wireless/intersil/hostap/hostap_ioctl.c +++ b/drivers/net/wireless/intersil/hostap/hostap_ioctl.c @@ -3630,7 +3630,7 @@ static int prism2_ioctl_get_encryption(local_info_t *local, param->u.crypt.key_len = 0; param->u.crypt.idx = 0xff; } else { - strncpy(param->u.crypt.alg, (*crypt)->ops->name, + strscpy(param->u.crypt.alg, (*crypt)->ops->name, HOSTAP_CRYPT_ALG_NAME_LEN); param->u.crypt.key_len = 0; From patchwork Tue Jun 13 14:09:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 13278871 X-Patchwork-Delegate: kvalo@adurom.com 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 27936EB64D9 for ; Tue, 13 Jun 2023 14:11:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240907AbjFMOLC (ORCPT ); Tue, 13 Jun 2023 10:11:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242897AbjFMOJx (ORCPT ); Tue, 13 Jun 2023 10:09:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 111B6F4 for ; Tue, 13 Jun 2023 07:09:29 -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 B6AD56369C for ; Tue, 13 Jun 2023 14:09:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D4F1C433F1 for ; Tue, 13 Jun 2023 14:09:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686665365; bh=UWviLmUQtcOm7LzTkSJw98/7WABHY5pbWNAmzo5BxxI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=HHPscYgjiFynln4B7eHkS9jFtXArrNMn+Rj2UmPZmiKGa9F7HpYz6MYXAlPvEPwt4 dSeXUGmuufEynKxdEGC2tVB/T3+zAl5NvdHvj23q+Tjld/yryqhhsFYw2eHSvPv6bv /9VUNk+m9xluyxE0KgGw2pw2scMXI3aHCNftI+d0lWCV+7REr1O39fcHK3MvJA1bu/ 5kuCLMLkLi7Wd0H2aHrzZisUa7Xo5snQmYzhYMOmPEiW79QJvHg8LAikbO/TJcQ+y4 /vCOWTXlF5yy205RedbEM7itqTzJBMGE8qqMiM3DNTpGsMFUm5kbk/2YGF2Lt7U/Wc PYhxDGIFtAYfw== From: Kalle Valo To: linux-wireless@vger.kernel.org Subject: [PATCH 4/4] wifi: ray_cs: fix stringop-truncation GCC warning Date: Tue, 13 Jun 2023 17:09:18 +0300 Message-Id: <20230613140918.389690-5-kvalo@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230613140918.389690-1-kvalo@kernel.org> References: <20230613140918.389690-1-kvalo@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org GCC 12.2 with W=1 warns: drivers/net/wireless/legacy/ray_cs.c:630:17: warning: 'strncpy' specified bound 32 equals destination size [-Wstringop-truncation] The driver uses SSID as a string which is just wrong, it should be treated as a byte array instead. But as the driver is ancient and most likely there are no users so convert it to use strscpy(). This makes sure that the string is NUL-terminated and also the warning is fixed. Signed-off-by: Kalle Valo --- drivers/net/wireless/legacy/ray_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/legacy/ray_cs.c b/drivers/net/wireless/legacy/ray_cs.c index 4b53a9c70e7e..8ace797ce951 100644 --- a/drivers/net/wireless/legacy/ray_cs.c +++ b/drivers/net/wireless/legacy/ray_cs.c @@ -627,7 +627,7 @@ static void init_startup_params(ray_dev_t *local) local->sparm.b4.a_acting_as_ap_status = TYPE_STA; if (essid != NULL) - strncpy(local->sparm.b4.a_current_ess_id, essid, ESSID_SIZE); + strscpy(local->sparm.b4.a_current_ess_id, essid, ESSID_SIZE); } /* init_startup_params */ /*===========================================================================*/