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

From: Jeff Johnson
Date: Mon Oct 23 2023 - 19:41:46 EST


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?
just want to know what other u8 arrays might require this.
FWIW the documentation referenced by the __nonstring macro explicitly refers
to "type array of char, signed char, or unsigned char"

The use of __nonstring is for byte arrays that are _not_ expected to be
%NUL terminated. Unfortunately "char" vs "u8" isn't distinguished by the
compiler. All byte arrays are treated as C strings unless __nonstring is
used.

So is the plan to annotate every single binary blob array in the kernel as __nonstring? I suspect those outnumber string arrays.