From patchwork Thu Feb 29 08:40:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Antipov X-Patchwork-Id: 777039 Received: from forward103c.mail.yandex.net (forward103c.mail.yandex.net [178.154.239.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A936143AD5 for ; Thu, 29 Feb 2024 08:41:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.154.239.214 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709196068; cv=none; b=CWUfhWaMCl883W4D3sgRREHjq42rffrRfKn6g7N31SvZcR/bovlp+J3CXebsv8gsSxha6us+h+QM8OoIzpHbTz+UB3v9DCze/hiV3y4i8v/O44ib1bVwxif4gaf9Af56Wsw6E9SdSCE+1ZF4DoMWHRLBoO7KNE0hKxFHeY/8Eu4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709196068; c=relaxed/simple; bh=tq0wf6eEo8lPoEY7Vg8wPwEQ2+/zhBI1SDEB7FHWoBQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gdnuUEPfMuwV7Uoyw1CaYzLOs/NHsvJdMJDMSlSDJ0QuWC+8GDJZJdHx+0Gf5yXzGZ9x/LPCNrz/U4C6N4TF+1HbdavTGRbsMAvxjYPsgEY3At8oFwjnjJTC3Q/rYSA+E/yUn00IEgS/7ICOUhFiSDno0nsrb9lv2SbR/LDLl74= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru; spf=pass smtp.mailfrom=yandex.ru; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b=fPcJytgm; arc=none smtp.client-ip=178.154.239.214 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yandex.ru Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b="fPcJytgm" Received: from mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net [IPv6:2a02:6b8:c14:6e01:0:640:627f:0]) by forward103c.mail.yandex.net (Yandex) with ESMTPS id 129A860B62; Thu, 29 Feb 2024 11:40:57 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id teVSqmLJiW20-6Zz5L67T; Thu, 29 Feb 2024 11:40:56 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1709196056; bh=0Ttr1Rc6LQgnqCWP+1fX+y357g9rrnweJwnKxC38lcw=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=fPcJytgmrLEdj4b4RUjGE1QFf2MbLbirXX7ySfLWviSpH9d84PMpWcv4JDZrKDeI/ NlE9eu7RmuIm8isWTbIH04HFEcQTM7NKeK4WbMMPmlWIBXqjjbWpNaJK/wvz0efAh+ aSaN3+xDLSrJd/2Kr1/STmhI0dLvEVz1fLSM4vfE= Authentication-Results: mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Jeff Johnson Cc: Baochen Qiang , Kalle Valo , ath11k@lists.infradead.org, linux-wireless@vger.kernel.org, lvc-project@linuxtesting.org, Dmitry Antipov Subject: [PATCH 1/3] [v2] wifi: ath11k: use ath11k_mac_get_ar_by_pdev_id() consistently Date: Thu, 29 Feb 2024 11:40:29 +0300 Message-ID: <20240229084031.51957-1-dmantipov@yandex.ru> X-Mailer: git-send-email 2.44.0 In-Reply-To: <788f1df8-64e1-4b3c-ae8e-00c67be1c3de@quicinc.com> References: <788f1df8-64e1-4b3c-ae8e-00c67be1c3de@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Since 'ath11k_mac_get_ar_by_pdev_id()' can return NULL, check the return value in 'ath11k_wmi_tlv_rssi_chain_parse()' as well as in 'ath11k_wmi_tlv_fw_stats_data_parse()', and return -EINVAL in case of error. Compile tested only. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Dmitry Antipov --- v2: aggregate to the series --- drivers/net/wireless/ath/ath11k/wmi.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index 34ab9631ff36..2d93e4e78a37 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -6498,6 +6498,12 @@ static int ath11k_wmi_tlv_rssi_chain_parse(struct ath11k_base *ab, rcu_read_lock(); ar = ath11k_mac_get_ar_by_pdev_id(ab, ev->pdev_id); + if (!ar) { + ath11k_warn(ab, "%s: invalid pdev_id %d\n", + __func__, ev->pdev_id); + ret = -EINVAL; + goto exit; + } stats->stats_id = WMI_REQUEST_RSSI_PER_CHAIN_STAT; ath11k_dbg(ab, ATH11K_DBG_WMI, @@ -6570,6 +6576,12 @@ static int ath11k_wmi_tlv_fw_stats_data_parse(struct ath11k_base *ab, rcu_read_lock(); ar = ath11k_mac_get_ar_by_pdev_id(ab, ev->pdev_id); + if (!ar) { + ath11k_warn(ab, "%s: invalid pdev_id %d\n", + __func__, ev->pdev_id); + ret = -EINVAL; + goto exit; + } for (i = 0; i < ev->num_pdev_stats; i++) { const struct wmi_pdev_stats *src; From patchwork Thu Feb 29 08:40:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Antipov X-Patchwork-Id: 777424 Received: from forward103b.mail.yandex.net (forward103b.mail.yandex.net [178.154.239.150]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFBC850A63 for ; Thu, 29 Feb 2024 08:41:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.154.239.150 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709196069; cv=none; b=d5kXF1ykBpErVjQ7p09KZ5RWXlfnjPdSeEWtxv6qATJbYBsvLVPgIHgQXHBbwsnISeMCOd3nNRTwnPH9KTO8SXl+JpJ6x/A0j4FPqCIKT07SlfmLX2Aiqw4Ebttr8c8yGYcXNhRjamFNuG/m34ta7my61/ti3QrGY6OrV8Fvgs0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709196069; c=relaxed/simple; bh=FPC/7D9VUAWtvds0/iDUODpNTYLTF9IwPj1Va/W1jfw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sAedkdbiXCtNB+8UEmi47t+E4F0a+YzuyV+hb1roguQ52gmEdbSWy7MMe6zcrzYz2tRF7+vQc7oHeE9w8JvdQMHV/ecoqM5vXFZjoKu7QfbeTY6KZ7Jt7eZYh+g/6pFkw3lYTlEDxzsyl4J2GkoGSMo05esQEM2sPpLfYxLhswo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru; spf=pass smtp.mailfrom=yandex.ru; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b=tKrXytYX; arc=none smtp.client-ip=178.154.239.150 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yandex.ru Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b="tKrXytYX" Received: from mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net [IPv6:2a02:6b8:c14:6e01:0:640:627f:0]) by forward103b.mail.yandex.net (Yandex) with ESMTPS id 2207E608F4; Thu, 29 Feb 2024 11:40:58 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id teVSqmLJiW20-XbXOpn5f; Thu, 29 Feb 2024 11:40:57 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1709196057; bh=Y8PDnHy/+7z0sDz6icCVsb+FrINzU6iAYcCS8mDYRMc=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=tKrXytYXXTgBiriEUfIaIKTE08u7e7f7B2KmMrKNrb2l22syKt0nX433X86cjOBJ7 qRQKprR8WWG05Im2GIsSlta7h3Xpzc9b+w6sp00Ky1Tb9BeuV4EXKoEcccEYALBYwl 6XL+/J0VWmvLuEPCOSJ+4F+PFjEvIBm3fcFqdbJg= Authentication-Results: mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Jeff Johnson Cc: Baochen Qiang , Kalle Valo , ath11k@lists.infradead.org, linux-wireless@vger.kernel.org, lvc-project@linuxtesting.org, Dmitry Antipov Subject: [PATCH 2/3] [v2] wifi: ath11k: handle unknown scan state in ath11k_mac_op_remain_on_channel() Date: Thu, 29 Feb 2024 11:40:30 +0300 Message-ID: <20240229084031.51957-2-dmantipov@yandex.ru> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240229084031.51957-1-dmantipov@yandex.ru> References: <788f1df8-64e1-4b3c-ae8e-00c67be1c3de@quicinc.com> <20240229084031.51957-1-dmantipov@yandex.ru> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In 'ath11k_mac_op_remain_on_channel()', add fallback default to handle an unknown scan state with -EINVAL. Compile tested only. Initially found by Linux Verification Center (linuxtesting.org) with SVACE (and reported as an attempt to use uninitialized variable). Suggested-by: Jeff Johnson Signed-off-by: Dmitry Antipov --- v2: prefer fallback branch over dummy initializer (Jeff Johnson) --- drivers/net/wireless/ath/ath11k/mac.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index a6a37d67a50a..47d3d5fd0423 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -9224,6 +9224,11 @@ static int ath11k_mac_op_remain_on_channel(struct ieee80211_hw *hw, case ATH11K_SCAN_ABORTING: ret = -EBUSY; break; + default: + ath11k_warn(ar->ab, "%s: unexpected scan state: %d\n", + __func__, ar->scan.state); + ret = -EINVAL; + break; } spin_unlock_bh(&ar->data_lock); From patchwork Thu Feb 29 08:40:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Antipov X-Patchwork-Id: 777038 Received: from forward203c.mail.yandex.net (forward203c.mail.yandex.net [178.154.239.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B93152F65 for ; Thu, 29 Feb 2024 08:41:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.154.239.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709196072; cv=none; b=AYQUJ97qgeQxKlrrfR/QlunMvbqZvoHQPUcSykmQQoRfFO2plawuLCNHjvl6CRWb10i9etIgRgEeqbjwToiv1sKW9VNUW7aFa019JP8crK2icTgqWAUx4PhbyARfDrAkbkzdTKRbvGjqP8AVtlrmKMRmHMuaf9Dg+V7zuzZp9lQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709196072; c=relaxed/simple; bh=32vgW31IsGnFpXY0jSvBWmEx0mmTVKtOzYQKYUV5jLM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ACg909McrYnrEzl+zIXRYZwZdjGiE0khfA8adSOjTPZ8N9Mp3J/6urPoheWrDIaaBND/3ZNSKiX0SqKexRlw0Xu2IdgkcBaWL80sC0+swBP/7HjgXH4/NcSM7cjKFKCRLXsUIw1TeaYk7aRhgjBAuGQ8t48MEwNyVeVaeUMVzYc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru; spf=pass smtp.mailfrom=yandex.ru; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b=YVWJWqBz; arc=none smtp.client-ip=178.154.239.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yandex.ru Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b="YVWJWqBz" Received: from forward101b.mail.yandex.net (forward101b.mail.yandex.net [IPv6:2a02:6b8:c02:900:1:45:d181:d101]) by forward203c.mail.yandex.net (Yandex) with ESMTPS id BE7D16338A for ; Thu, 29 Feb 2024 11:41:06 +0300 (MSK) Received: from mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net [IPv6:2a02:6b8:c14:6e01:0:640:627f:0]) by forward101b.mail.yandex.net (Yandex) with ESMTPS id 814E560A7A; Thu, 29 Feb 2024 11:40:59 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id teVSqmLJiW20-ppqodj5g; Thu, 29 Feb 2024 11:40:58 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1709196058; bh=etD7nXdUPW+wM9En1JEoPr/6++ncac2+Uo/5yHDDw2w=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=YVWJWqBzZPFo39FdY5QZJ0WeKhxQhrd54W3PQ4T/d8hlnf4+GBEshzvy191xaGHQk JNxbWY4U8bwRZHHIijJvWPrZoHsj6W7qHMDst1NHXZ6fkA4UKlv8kOCktPbnVOEbL8 bmzUteaGyvzWNJX9I5dErU0rqipzgarnmmjpky8w= Authentication-Results: mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Jeff Johnson Cc: Baochen Qiang , Kalle Valo , ath11k@lists.infradead.org, linux-wireless@vger.kernel.org, lvc-project@linuxtesting.org, Dmitry Antipov Subject: [PATCH 3/3] [v2] wifi: ath11k: fix few -Wmaybe-uninitialized warnings Date: Thu, 29 Feb 2024 11:40:31 +0300 Message-ID: <20240229084031.51957-3-dmantipov@yandex.ru> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240229084031.51957-1-dmantipov@yandex.ru> References: <788f1df8-64e1-4b3c-ae8e-00c67be1c3de@quicinc.com> <20240229084031.51957-1-dmantipov@yandex.ru> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When compiling with gcc version 14.0.1 20240226 (experimental) and W=12, I've noticed the following warnings: drivers/net/wireless/ath/ath11k/qmi.c: In function 'ath11k_qmi_load_file_target_mem': drivers/net/wireless/ath/ath11k/qmi.c:2401:16: warning: 'ret' may be used uninitialized [-Wmaybe-uninitialized] 2401 | return ret; drivers/net/wireless/ath/ath11k/qmi.c: In function 'ath11k_qmi_load_bdf_qmi': drivers/net/wireless/ath/ath11k/qmi.c:2494:17: warning: 'fw_entry' may be used uninitialized [-Wmaybe-uninitialized] 2494 | release_firmware(fw_entry); And a bunch of them traced to an uninitialized fields of the same variable, e.g.: drivers/net/wireless/ath/ath11k/spectral.c: In function 'ath11k_spectral_process_data': drivers/net/wireless/ath/ath11k/spectral.c:700:47: warning: 'summ_rpt.meta.freq1' may be used uninitialized [-Wmaybe-uninitialized] 700 | struct ath11k_spectral_summary_report summ_rpt; Fix all of the above by using 0, NULL, and {} initializers, respectively. Note there are few more (less obvious) -Wmaybe-uninitialized warnings still remains, but they're hardly possible to fix without running on a physical hardware. Compile tested only. Also noticed by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Dmitry Antipov --- v2: use {} initializer (Jeff Johnson) and aggregate to the series --- drivers/net/wireless/ath/ath11k/qmi.c | 4 ++-- drivers/net/wireless/ath/ath11k/spectral.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c index 5006f81f779b..4477f652e068 100644 --- a/drivers/net/wireless/ath/ath11k/qmi.c +++ b/drivers/net/wireless/ath/ath11k/qmi.c @@ -2293,7 +2293,7 @@ static int ath11k_qmi_load_file_target_mem(struct ath11k_base *ab, struct qmi_txn txn; const u8 *temp = data; void __iomem *bdf_addr = NULL; - int ret; + int ret = 0; u32 remaining = len; req = kzalloc(sizeof(*req), GFP_KERNEL); @@ -2406,7 +2406,7 @@ static int ath11k_qmi_load_bdf_qmi(struct ath11k_base *ab, { struct device *dev = ab->dev; char filename[ATH11K_QMI_MAX_BDF_FILE_NAME_SIZE]; - const struct firmware *fw_entry; + const struct firmware *fw_entry = NULL; struct ath11k_board_data bd; u32 fw_size, file_type; int ret = 0, bdf_type; diff --git a/drivers/net/wireless/ath/ath11k/spectral.c b/drivers/net/wireless/ath/ath11k/spectral.c index 79e091134515..9834e7dc5120 100644 --- a/drivers/net/wireless/ath/ath11k/spectral.c +++ b/drivers/net/wireless/ath/ath11k/spectral.c @@ -697,7 +697,7 @@ static int ath11k_spectral_process_data(struct ath11k *ar, struct ath11k_base *ab = ar->ab; struct spectral_tlv *tlv; struct spectral_summary_fft_report *summary = NULL; - struct ath11k_spectral_summary_report summ_rpt; + struct ath11k_spectral_summary_report summ_rpt = {}; struct fft_sample_ath11k *fft_sample = NULL; u8 *data; u32 data_len, i;