From: Kees Cook <keescook@chromium.org>
To: Jeff Johnson <quic_jjohnson@quicinc.com>
Cc: Kalle Valo <kvalo@kernel.org>,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
ath10k@lists.infradead.org, linux-wireless@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/6] wifi: ath10k: remove duplicate memset() in 10.4 TDLS peer update
Date: Wed, 13 Dec 2023 11:37:10 -0800 [thread overview]
Message-ID: <202312131136.5C46279@keescook> (raw)
In-Reply-To: <bdabfb74-ea4f-4455-bb4c-1d93977393ea@quicinc.com>
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>
--
Kees Cook
next prev parent reply other threads:[~2023-12-13 19:37 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-13 17:06 [PATCH 0/6] wifi: ath10k: use flexible arrays Jeff Johnson
2023-12-13 17:06 ` [PATCH 1/6] wifi: ath10k: use flexible array in struct wmi_host_mem_chunks Jeff Johnson
2023-12-13 19:10 ` Kees Cook
2023-12-13 20:14 ` Gustavo A. R. Silva
2023-12-18 18:47 ` Kalle Valo
2023-12-18 18:51 ` Gustavo A. R. Silva
2023-12-13 17:06 ` [PATCH 2/6] wifi: ath10k: use flexible arrays for WMI start scan TLVs Jeff Johnson
2023-12-13 19:11 ` Kees Cook
2023-12-13 20:17 ` Gustavo A. R. Silva
2023-12-13 17:06 ` [PATCH 3/6] wifi: ath10k: remove struct wmi_pdev_chanlist_update_event Jeff Johnson
2023-12-13 19:12 ` Kees Cook
2023-12-13 20:18 ` Gustavo A. R. Silva
2023-12-13 17:06 ` [PATCH 4/6] wifi: ath10k: remove unused template structs Jeff Johnson
2023-12-13 19:12 ` Kees Cook
2023-12-13 20:19 ` Gustavo A. R. Silva
2023-12-13 17:06 ` [PATCH 5/6] wifi: ath10k: use flexible array in struct wmi_tdls_peer_capabilities Jeff Johnson
2023-12-13 19:13 ` Kees Cook
2023-12-13 20:19 ` Gustavo A. R. Silva
2023-12-13 17:06 ` [PATCH 6/6] wifi: ath10k: remove duplicate memset() in 10.4 TDLS peer update Jeff Johnson
2023-12-13 19:16 ` Kees Cook
2023-12-13 19:36 ` Jeff Johnson
2023-12-13 19:37 ` Kees Cook [this message]
2023-12-13 20:20 ` Gustavo A. R. Silva
2023-12-13 20:21 ` [PATCH 0/6] wifi: ath10k: use flexible arrays Gustavo A. R. Silva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202312131136.5C46279@keescook \
--to=keescook@chromium.org \
--cc=ath10k@lists.infradead.org \
--cc=gustavo@embeddedor.com \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=quic_jjohnson@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).