[PATCH] accel/habanalabs: refactor deprecated strncpy to strscpy_pad

2023-08-25 Thread Justin Stitt
`strncpy` is deprecated for use on NUL-terminated destination strings [1]. We see that `prop->cpucp_info.card_name` is supposed to be NUL-terminated based on its usage within `__hwmon_device_register()` (wherein it's called "name"): | if (name && (!strlen(name) || strpbrk(name, "-* \t\n")))

Re: [PATCH] accel/habanalabs: refactor deprecated strncpy to strscpy_pad

2023-08-25 Thread Kees Cook
On Fri, Aug 25, 2023 at 10:09:51PM +, Justin Stitt wrote: > `strncpy` is deprecated for use on NUL-terminated destination strings [1]. > > We see that `prop->cpucp_info.card_name` is supposed to be > NUL-terminated based on its usage within `__hwmon_device_register()` > (wherein it's called "n

Re: [PATCH] accel/habanalabs: refactor deprecated strncpy to strscpy_pad

2023-08-31 Thread Oded Gabbay
On Sat, Aug 26, 2023 at 1:13 AM Kees Cook wrote: > > On Fri, Aug 25, 2023 at 10:09:51PM +, Justin Stitt wrote: > > `strncpy` is deprecated for use on NUL-terminated destination strings [1]. > > > > We see that `prop->cpucp_info.card_name` is supposed to be > > NUL-terminated based on its usage