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

2023-09-18 Thread Oded Gabbay
On Fri, Aug 25, 2023 at 12:19 PM Stanislaw Gruszka wrote: > > On Wed, Aug 23, 2023 at 12:23:08AM +, Justin Stitt wrote: > > `strncpy` is deprecated for use on NUL-terminated destination strings [1]. > > > > A suitable replacement is `strscpy` [2] due to the fact that it > > guarantees

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

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

[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

2023-08-25 Thread Stanislaw Gruszka
On Wed, Aug 23, 2023 at 12:23:08AM +, Justin Stitt wrote: > `strncpy` is deprecated for use on NUL-terminated destination strings [1]. > > A suitable replacement is `strscpy` [2] due to the fact that it > guarantees NUL-termination on its destination buffer argument which is > _not_ the case

[PATCH] accel/habanalabs: refactor deprecated strncpy

2023-08-22 Thread Justin Stitt
`strncpy` is deprecated for use on NUL-terminated destination strings [1]. A suitable replacement is `strscpy` [2] due to the fact that it guarantees NUL-termination on its destination buffer argument which is _not_ the case for `strncpy`! There is likely no bug happening in this case since