Received: by 2002:ab2:3b09:0:b0:1ed:14ea:9113 with SMTP id b9csp124288lqc; Thu, 29 Feb 2024 12:10:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXOPQcQnYolbgYUFf1KosnxvC7RV1ExKW7FpdV4DBj7yqleGjSYD11TGHrXdgFC0aPvAaBF/41se/lz1NxmB2hftrobTo1WpiMJd8yS/g== X-Google-Smtp-Source: AGHT+IFeABDxUwHZJvlHVk0tNxX6xaNhMax2nGX5EBZRDVHIjk+OwZEwVAFJXVK/+x57KcOpofsg X-Received: by 2002:a17:902:ecc5:b0:1dc:79e3:c8ed with SMTP id a5-20020a170902ecc500b001dc79e3c8edmr3544268plh.31.1709237427810; Thu, 29 Feb 2024 12:10:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709237427; cv=pass; d=google.com; s=arc-20160816; b=SHwMY/PF8/b3zJjw0WAawZWt15vQ+TM56NjgmpLs32ZUf1nrKBwh9B1bxgPqtwjZzD HBWRVC9JcDb9HgbhLcKoczcSBHg27vamNVxXMAgLjO3QEvH3+VEavfYeFTevAEiieIMq RpY9kOWFNndlDmsp6PJHL7mPAUvGOhLDA3cqAks4TXJcUmKTut1VUxbWClihOe6YPF14 VWcS06a2kzcIlnb5sme9bK55MRX32N+Wqs/s/G4UEbh97jxY1WVagBAdh0qXhhaOX4h/ Uf3A9ijlEFhZuUi1alvccgWBvz3biu8xu0ftmFtGJuERvLGb2FQI3MClwgjDGysOgx7s yA8A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=1CcyJbEfna7NtQC9oeqraeumFk2pyv8puZ1bXPL2s3I=; fh=RTEbzlvcU4udBcnsUgL7lJma0HDUvTsSM2wHZJ3hg5U=; b=A6AAYsCj8vnNd/i0GMdFGFl+KI3Jp+QNU2wovZSjMkwOaWgQucf6gun0Ew2H+VtvJY FfDEDSeNWB+oN+q7ZM/cs00kru6oe5l+lsSBWoc1d/f8n/t+12+I+QQiyVFsHIJFHfMt /x1L4hmM3SvEZinLEsmGzUFCpHuDU1+mV6N9ms6TffzlmkD59UhjJ2RZo2+Nr+7NeHss Go0a2pSCHU3MDYxS+upkrSieIqnU8XgENQ8lxr0u3dpwgZp/D5ig7py8UUWJ64JnkitC VSZWf00f+MTBz4WtScOj7P3eWqKR46RHb26v7U10DVRFlIP2qmNf13cjPTUzN50pOBG6 Pw6Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=VCBzc9zf; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-4265-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4265-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p5-20020a170902780500b001db3613aacbsi1839944pll.617.2024.02.29.12.10.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 12:10:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4265-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=VCBzc9zf; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-wireless+bounces-4265-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4265-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7AE3A285EAC for ; Thu, 29 Feb 2024 20:10:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8279213D316; Thu, 29 Feb 2024 20:10:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="VCBzc9zf" X-Original-To: linux-wireless@vger.kernel.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 E01AA13C9EE for ; Thu, 29 Feb 2024 20:10:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709237425; cv=none; b=XLHnmiujMclC+5qv9JdZwXMG8gQlBw8JdqeFr0oS6H6sprWMIM3LmapOF4P8Bv/FlOvA+H8KpcsQ14eho2bXC8BD8oOgTWWQoMQ9yCpcJ2b1efSKLXmQyfoRq5/R5yghBvqsZrfsL2ri1ebP51e73fiwDbkpOc1OlovRsY+Vzmg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709237425; c=relaxed/simple; bh=yA6n56QKwdJHgdXFbJxc5ZpKsxagZ6W196E9A9a0WMM=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=VJBXPtcKWdvvzHrDL1Du2W5kT6zdkjO5Q+BygjOT5vBHi6pjizgxlCMRUTZZn+rUBeoDehK0G186kgRmAZHrhkGiwK4vYh9m73jM8GKXdj3cxX50UrJt0qcWeEA1aRZkmTHW3qDzdOzSg97iUdjKfHnCXiEYx2kKeUc4Kg3BPBY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=VCBzc9zf; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41TIe7WI014560; Thu, 29 Feb 2024 20:10:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= qcppdkim1; bh=1CcyJbEfna7NtQC9oeqraeumFk2pyv8puZ1bXPL2s3I=; b=VC Bzc9zf9qkd3ggbuDrgcEZCzglOtVlknjelQJFxOctnV70G2tC0LOgiMQdpBaBu7Y hGzLWzJT8RGzc/pY+yonRgw31O5NjEO97o74WuEe9ZACeogzUNV1HDt5f+UjUAN5 UvjR4pX0Dd7c6RPUAJUUVsJApC8Dh1CEYUKZwDepYU8fHVD4fqQt/Ij/SWBMrF04 TAR9oLNAdlSYoVe8GJpYTlI/elwRoGbNDF7XAPP5pfA8Cqz8aNr2w6eHLDEVnb5P +/XLI9tK42twf8DzGoCCgF4/Sq/twAvLWskFaZmchPP69XacYK8eS9nmYbBFoaHh IxrZQ2Xlrt+ShCoZmRSw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wjycdg6ps-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Feb 2024 20:10:16 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41TKAFTL015090 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Feb 2024 20:10:15 GMT Received: from [10.110.42.209] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Thu, 29 Feb 2024 12:10:14 -0800 Message-ID: Date: Thu, 29 Feb 2024 12:10:14 -0800 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/3] [v2] wifi: ath11k: use ath11k_mac_get_ar_by_pdev_id() consistently Content-Language: en-US To: Dmitry Antipov CC: Baochen Qiang , Kalle Valo , , , References: <788f1df8-64e1-4b3c-ae8e-00c67be1c3de@quicinc.com> <20240229084031.51957-1-dmantipov@yandex.ru> From: Jeff Johnson In-Reply-To: <20240229084031.51957-1-dmantipov@yandex.ru> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: C-RQTzIEMqjFWTfTJuKp1c45sdQnVpO4 X-Proofpoint-ORIG-GUID: C-RQTzIEMqjFWTfTJuKp1c45sdQnVpO4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-29_06,2024-02-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 phishscore=0 mlxlogscore=874 impostorscore=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 adultscore=0 suspectscore=0 spamscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402290156 On 2/29/2024 12:40 AM, Dmitry Antipov wrote: > 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 In the future please don't use In-Reply-To: when submitting a new version of a patch/series. Each version should start its own thread. Having In-Reference-To: is OK > --- > 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); it is currently not the convention to use __func__ in ath11k logs. there are currently 6 instances where the NULL check is present, and each has a custom log message I personally would be ok having this new format, but want to get Kalle's approval for that. But if we do that I'd also want a follow-up patch to modify those 6 existing logs. FWIW in all of ath11k there are only 3 instances of __func__: mac.c: "%s: rsn ie found\n", __func__); mac.c: "%s: wpa ie found\n", __func__); wmi.c: __func__); > + 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; The actual logic is correct. /jeff