[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <169873838825.2137176.1962660661621825377.kvalo@kernel.org>
Date: Tue, 31 Oct 2023 07:46:30 +0000 (UTC)
From: Kalle Valo <kvalo@...nel.org>
To: Justin Stitt <justinstitt@...gle.com>
Cc: Jeff Johnson <quic_jjohnson@...cinc.com>, ath10k@...ts.infradead.org,
linux-wireless@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org, Justin Stitt <justinstitt@...gle.com>
Subject: Re: [PATCH v2] wifi: ath10k: replace deprecated strncpy with memcpy
Justin Stitt <justinstitt@...gle.com> wrote:
> strncpy() is deprecated [1] and we should prefer less ambiguous
> interfaces.
>
> In this case, arvif->u.ap.ssid has its length maintained by
> arvif->u.ap.ssid_len which indicates it may not need to be
> NUL-terminated. Make this explicit with __nonstring and use a plain old
> memcpy.
>
> This is also consistent with future copies into arvif->u.ap.ssid:
>
> if (changed & BSS_CHANGED_SSID &&
> vif->type == NL80211_IFTYPE_AP) {
> arvif->u.ap.ssid_len = vif->cfg.ssid_len;
> if (vif->cfg.ssid_len)
> memcpy(arvif->u.ap.ssid, vif->cfg.ssid,
> vif->cfg.ssid_len);
> arvif->u.ap.hidden_ssid = info->hidden_ssid;
> }
>
> Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
> Link: https://github.com/KSPP/linux/issues/90
> Cc: linux-hardening@...r.kernel.org
> Signed-off-by: Justin Stitt <justinstitt@...gle.com>
> Acked-by: Jeff Johnson <quic_jjohnson@...cinc.com>
> Signed-off-by: Kalle Valo <quic_kvalo@...cinc.com>
Patch applied to ath-next branch of ath.git, thanks.
ac2f43d3d34e wifi: ath10k: replace deprecated strncpy with memcpy
--
https://patchwork.kernel.org/project/linux-wireless/patch/20231024-strncpy-drivers-net-wireless-ath-ath10k-mac-c-v2-1-4c1f4cd4b4df@google.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Powered by blists - more mailing lists