Re: [PATCH] ath10k: replace deprecated strncpy with strtomem_pad

2023-10-24 Thread Kees Cook
On Tue, Oct 24, 2023 at 04:25:35PM -0700, Jeff Johnson wrote: > On 10/24/2023 2:43 PM, Kees Cook wrote: > > On Tue, Oct 24, 2023 at 07:11:51AM -0700, Jeff Johnson wrote: > > > On 10/24/2023 6:03 AM, Kalle Valo wrote: > > > > What about using just memcpy() to make it clear it's not really a proper

Re: [PATCH] ath10k: replace deprecated strncpy with strtomem_pad

2023-10-24 Thread Jeff Johnson
On 10/24/2023 2:43 PM, Kees Cook wrote: On Tue, Oct 24, 2023 at 07:11:51AM -0700, Jeff Johnson wrote: On 10/24/2023 6:03 AM, Kalle Valo wrote: What about using just memcpy() to make it clear it's not really a proper string: arvif->u.ap.ssid_len = 4; memcpy(arvif->u.ap.ssid, "mesh",

Re: [PATCH] ath10k: replace deprecated strncpy with strtomem_pad

2023-10-24 Thread Kees Cook
On Tue, Oct 24, 2023 at 07:11:51AM -0700, Jeff Johnson wrote: > On 10/24/2023 6:03 AM, Kalle Valo wrote: > > What about using just memcpy() to make it clear it's not really a proper > > string: > > > > arvif->u.ap.ssid_len = 4; > > memcpy(arvif->u.ap.ssid, "mesh", arvif->u.ap.ssid_len); > > > >

Re: [PATCH] ath10k: replace deprecated strncpy with strtomem_pad

2023-10-24 Thread Jeff Johnson
On 10/24/2023 6:03 AM, Kalle Valo wrote: What about using just memcpy() to make it clear it's not really a proper string: arvif->u.ap.ssid_len = 4; memcpy(arvif->u.ap.ssid, "mesh", arvif->u.ap.ssid_len); In the "changed & BSS_CHANGED_SSID" case that comes soon after this we just set the

Re: [PATCH] ath10k: replace deprecated strncpy with strtomem_pad

2023-10-24 Thread Kalle Valo
Justin Stitt writes: > 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, although by virtue of using strtomem_pad (with

Re: [PATCH] ath10k: replace deprecated strncpy with strtomem_pad

2023-10-23 Thread Jeff Johnson
On 10/18/2023 4:35 PM, Kees Cook wrote: On Fri, Oct 13, 2023 at 05:58:03PM -0700, Jeff Johnson wrote: Let's also mark ath10k_vif.u.ap.ssid as __nonstring. what criteria is used to determine whether or not to use __nonstring? doesn't the use of u8 vs char already communicate that distinction?

Re: [PATCH] ath10k: replace deprecated strncpy with strtomem_pad

2023-10-18 Thread Kees Cook
On Fri, Oct 13, 2023 at 05:58:03PM -0700, Jeff Johnson wrote: > On 10/13/2023 1:33 PM, Justin Stitt 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

Re: [PATCH] ath10k: replace deprecated strncpy with strtomem_pad

2023-10-13 Thread Jeff Johnson
On 10/13/2023 1:33 PM, Justin Stitt 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, although by virtue of using strtomem_pad

[PATCH] ath10k: replace deprecated strncpy with strtomem_pad

2023-10-13 Thread Justin Stitt
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, although by virtue of using strtomem_pad (with NUL-byte pad character) and having a