Message ID | 20231213-wmi_host_mem_chunks_flexarray-v1-6-92922d92fa2c@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp7925414dys; Wed, 13 Dec 2023 09:07:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEy6ebIcHvQkzYoXJ/3Q+w/3P6+p5/bkNYtEP7Ert6Y1fAOk+TDekpFV1CQeRGF7NoLroNC X-Received: by 2002:a17:902:8691:b0:1d3:5229:cf38 with SMTP id g17-20020a170902869100b001d35229cf38mr517370plo.6.1702487255901; Wed, 13 Dec 2023 09:07:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702487255; cv=none; d=google.com; s=arc-20160816; b=a6G78y94UYKBVmcmjKZ3+l4HAWcZ1WOvo51KsSf0oKs/cYOFTai0RWDaELk/Pyopl2 +q1ifsa8FqcGi9TohLqZmOgcPhezFZ5afXWn9V7LlR/lms7DDfwstL3QmL4crIf4JXML WsGfIwQkLWcOmPncGnP+yF1hIRrj2OXA6MSThrGHOikVuCpwCa8qZCFhb8OUtxAzaWVA dyrcKaJo5uO5/Bfx0MU2Sk8U1+dUjqdTHDSLBrRLbcyn8CkuCJRR+JsjdrcAttSXfwyp 8u18A5kJYHPSB0oFIXB1r4itNXNlipxP59K0MDaa1R185ZZr1ZnjV/qYJEBQ/WiOQkdu sYlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=g2R8Hf30ansh0q9veiXH67BzJDPzuP0bNK2kUtXNSos=; fh=f4dIorfYpvrEtypEqDl0xAr0U3fgNW6JnHp2tNMuoOs=; b=IJ9Pn2Pynm7APctNZxL05hK8H1of7jn6wfBwClXKwbf2XqKShMFGlOlsZX6Yth0JSU I79+MlAFq6oRu8EeDBxOZeCCtb4+BZVeWLHnY5Cb/uzO3ZoXryLVm8DlOZtoQPdxdwwA 0JKBe9kW8VvmHThU2Xl2kW8SDCBuTgmRIQPnEsVLnJRNAPhkLBsPbktROC/SZHCytjDr J2OryAB7ie715M4EZjwwbZvLjbgL9P6dCRxsJM2o9htcrhDdBO8zLIwRUJY5VfzX/t9b CL/ze+qpEP8A9o0/mG14zdYnUBr5ZuVuKiA6elQ58tOo9NVzOFVMdQ7SX7Z7t302GERa SLdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=mo1n7OBD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id u12-20020a17090341cc00b001d09e26a715si9749961ple.89.2023.12.13.09.07.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 09:07:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=mo1n7OBD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id E08D18077853; Wed, 13 Dec 2023 09:07:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233730AbjLMRHU (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Wed, 13 Dec 2023 12:07:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjLMRHO (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 13 Dec 2023 12:07:14 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43D34D0; Wed, 13 Dec 2023 09:07:21 -0800 (PST) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BDDnRpt014846; Wed, 13 Dec 2023 17:06:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=g2R8Hf30ansh0q9veiXH67BzJDPzuP0bNK2kUtXNSos =; b=mo1n7OBDa1yH+r8RdZTX5mnOsLptTudDDTFL9OmXBheyRZWnifbfbv8dB4c 7s+0xT3fgWs+AyJ6V7mLVWYofOxwmmik8FWMYm56phFHAcRl8r4aCR8QexrgjPVb Qn27K+o9a72ogLF/WFmZxnlk28r39C/HJlPW4KJX9gQOo4h5LeNB2ng1K3vEKP/3 Nz+nCVcPq+CvBkah3D89aFxJIDXDsQTZf6YKv69737iH5cu3oFSqn41mEKZ+fBZM cE89Wt6TJomsXLtvLelLsp6IUsyzc49tC7axSaPJoovzcuEeIkX+3uiWy2pseBVk 51YPtVdqQk8RdIN05bZj00Bz0EA== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uy9gd15qf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Dec 2023 17:06:43 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3BDH6gev024426 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Dec 2023 17:06:42 GMT Received: from [169.254.0.1] (10.49.16.6) 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; Wed, 13 Dec 2023 09:06:41 -0800 From: Jeff Johnson <quic_jjohnson@quicinc.com> Date: Wed, 13 Dec 2023 09:06:44 -0800 Subject: [PATCH 6/6] wifi: ath10k: remove duplicate memset() in 10.4 TDLS peer update MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-ID: <20231213-wmi_host_mem_chunks_flexarray-v1-6-92922d92fa2c@quicinc.com> References: <20231213-wmi_host_mem_chunks_flexarray-v1-0-92922d92fa2c@quicinc.com> In-Reply-To: <20231213-wmi_host_mem_chunks_flexarray-v1-0-92922d92fa2c@quicinc.com> To: Kalle Valo <kvalo@kernel.org>, Jeff Johnson <quic_jjohnson@quicinc.com> CC: Kees Cook <keescook@chromium.org>, "Gustavo A. R. Silva" <gustavo@embeddedor.com>, <ath10k@lists.infradead.org>, <linux-wireless@vger.kernel.org>, <linux-kernel@vger.kernel.org> X-Mailer: b4 0.12.3 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) 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-ORIG-GUID: o113M8uWNgMGPXX11Br_ZlzAUJuPoPVd X-Proofpoint-GUID: o113M8uWNgMGPXX11Br_ZlzAUJuPoPVd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 bulkscore=0 spamscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 clxscore=1015 phishscore=0 adultscore=0 mlxlogscore=521 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312130122 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 13 Dec 2023 09:07:30 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785187276660736166 X-GMAIL-MSGID: 1785187276660736166 |
Series |
wifi: ath10k: use flexible arrays
|
|
Commit Message
Jeff Johnson
Dec. 13, 2023, 5:06 p.m. UTC
In [1] it was identified that in ath10k_wmi_10_4_gen_tdls_peer_update()
the memset(skb->data, 0, sizeof(*cmd)) is unnecessary since function
ath10k_wmi_alloc_skb() already zeroes skb->data, so remove it.
No functional changes, compile tested only.
[1] https://lore.kernel.org/linux-wireless/626ae2e7-66f8-423b-b17f-e75c1a6d29b3@embeddedor.com/
Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
---
drivers/net/wireless/ath/ath10k/wmi.c | 2 --
1 file changed, 2 deletions(-)
Comments
On Wed, Dec 13, 2023 at 09:06:44AM -0800, Jeff Johnson wrote: > In [1] it was identified that in ath10k_wmi_10_4_gen_tdls_peer_update() > the memset(skb->data, 0, sizeof(*cmd)) is unnecessary since function > ath10k_wmi_alloc_skb() already zeroes skb->data, so remove it. Is .gen_tdls_peer_update only ever called after a fresh allocation? It wasn't obvious to me as I tried to follow the call paths. Is there harm in leaving this? -Kees > > No functional changes, compile tested only. > > [1] https://lore.kernel.org/linux-wireless/626ae2e7-66f8-423b-b17f-e75c1a6d29b3@embeddedor.com/ > > Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com> > --- > drivers/net/wireless/ath/ath10k/wmi.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c > index 4d5aadbc7159..0cfd9484c45e 100644 > --- a/drivers/net/wireless/ath/ath10k/wmi.c > +++ b/drivers/net/wireless/ath/ath10k/wmi.c > @@ -8918,8 +8918,6 @@ ath10k_wmi_10_4_gen_tdls_peer_update(struct ath10k *ar, > if (!skb) > return ERR_PTR(-ENOMEM); > > - memset(skb->data, 0, sizeof(*cmd)); > - > cmd = (struct wmi_10_4_tdls_peer_update_cmd *)skb->data; > cmd->vdev_id = __cpu_to_le32(arg->vdev_id); > ether_addr_copy(cmd->peer_macaddr.addr, arg->addr); > > -- > 2.42.0 >
On 12/13/2023 11:16 AM, Kees Cook wrote: > On Wed, Dec 13, 2023 at 09:06:44AM -0800, Jeff Johnson wrote: >> In [1] it was identified that in ath10k_wmi_10_4_gen_tdls_peer_update() >> the memset(skb->data, 0, sizeof(*cmd)) is unnecessary since function >> ath10k_wmi_alloc_skb() already zeroes skb->data, so remove it. > > Is .gen_tdls_peer_update only ever called after a fresh allocation? It > wasn't obvious to me as I tried to follow the call paths. Is there harm > in leaving this? The only harm is a slight increase in code size and cpu cycles. However note the skb allocation is done within ath10k_wmi_10_4_gen_tdls_peer_update() itself, just before the code being removed: skb = ath10k_wmi_alloc_skb(ar, len); if (!skb) return ERR_PTR(-ENOMEM); And in ath10k_wmi_alloc_skb() we have: memset(skb->data, 0, round_len); So the memset() being removed is always redundant. /jeff
On Wed, Dec 13, 2023 at 11:36:08AM -0800, Jeff Johnson wrote: > On 12/13/2023 11:16 AM, Kees Cook wrote: > > On Wed, Dec 13, 2023 at 09:06:44AM -0800, Jeff Johnson wrote: > >> In [1] it was identified that in ath10k_wmi_10_4_gen_tdls_peer_update() > >> the memset(skb->data, 0, sizeof(*cmd)) is unnecessary since function > >> ath10k_wmi_alloc_skb() already zeroes skb->data, so remove it. > > > > Is .gen_tdls_peer_update only ever called after a fresh allocation? It > > wasn't obvious to me as I tried to follow the call paths. Is there harm > > in leaving this? > > The only harm is a slight increase in code size and cpu cycles. > > However note the skb allocation is done within > ath10k_wmi_10_4_gen_tdls_peer_update() itself, just before the code > being removed: > skb = ath10k_wmi_alloc_skb(ar, len); > if (!skb) > return ERR_PTR(-ENOMEM); > > And in ath10k_wmi_alloc_skb() we have: > memset(skb->data, 0, round_len); > > So the memset() being removed is always redundant. LOL. I see now. I missed that was was looking outside the function! :P Reviewed-by: Kees Cook <keescook@chromium.org>
On 12/13/23 11:06, Jeff Johnson wrote: > In [1] it was identified that in ath10k_wmi_10_4_gen_tdls_peer_update() > the memset(skb->data, 0, sizeof(*cmd)) is unnecessary since function > ath10k_wmi_alloc_skb() already zeroes skb->data, so remove it. > > No functional changes, compile tested only. > > [1] https://lore.kernel.org/linux-wireless/626ae2e7-66f8-423b-b17f-e75c1a6d29b3@embeddedor.com/ > > Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> Thanks! -- Gustavo > --- > drivers/net/wireless/ath/ath10k/wmi.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c > index 4d5aadbc7159..0cfd9484c45e 100644 > --- a/drivers/net/wireless/ath/ath10k/wmi.c > +++ b/drivers/net/wireless/ath/ath10k/wmi.c > @@ -8918,8 +8918,6 @@ ath10k_wmi_10_4_gen_tdls_peer_update(struct ath10k *ar, > if (!skb) > return ERR_PTR(-ENOMEM); > > - memset(skb->data, 0, sizeof(*cmd)); > - > cmd = (struct wmi_10_4_tdls_peer_update_cmd *)skb->data; > cmd->vdev_id = __cpu_to_le32(arg->vdev_id); > ether_addr_copy(cmd->peer_macaddr.addr, arg->addr); >
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 4d5aadbc7159..0cfd9484c45e 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -8918,8 +8918,6 @@ ath10k_wmi_10_4_gen_tdls_peer_update(struct ath10k *ar, if (!skb) return ERR_PTR(-ENOMEM); - memset(skb->data, 0, sizeof(*cmd)); - cmd = (struct wmi_10_4_tdls_peer_update_cmd *)skb->data; cmd->vdev_id = __cpu_to_le32(arg->vdev_id); ether_addr_copy(cmd->peer_macaddr.addr, arg->addr);