Justin Stitt de055e6116 bus: fsl-mc: Replace deprecated strncpy() with strscpy_pad()
`strncpy` is deprecated for use on NUL-terminated destination strings [1].

We need to prefer more robust and less ambiguous string interfaces.

`obj_desc->(type|label)` are expected to be NUL-terminated strings as
per "include/linux/fsl/mc.h +143"
| ...
|  * struct fsl_mc_obj_desc - Object descriptor
|  * @type: Type of object: NULL terminated string
| ...

It seems `cmd_params->obj_type` is also expected to be a NUL-terminated string.

A suitable replacement is `strscpy_pad` due to the fact that it
guarantees NUL-termination on the destination buffer whilst keeping the
NUL-padding behavior that `strncpy` provides.

Padding may not strictly be necessary but let's opt to keep it as this
ensures no functional change.

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@vger.kernel.org
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230912-strncpy-drivers-bus-fsl-mc-dprc-c-v1-1-cdb56aa3f4f4@google.com
Signed-off-by: Kees Cook <keescook@chromium.org>
2023-09-29 14:48:31 -07:00
..
2023-08-22 15:50:57 +02:00
2023-09-08 21:39:54 -07:00
Hi,
2023-09-13 11:44:20 -07:00
2023-09-04 13:47:59 -07:00
2023-08-31 12:43:10 -07:00
2023-08-24 16:20:30 -07:00
2023-09-03 10:49:42 -07:00
2023-08-30 13:34:34 -07:00
2023-08-30 19:23:00 -07:00
2023-09-01 12:31:44 -07:00
2023-09-04 11:26:29 -07:00
2023-08-28 16:35:01 -07:00
2023-09-01 09:53:54 -07:00
2023-09-02 12:02:41 -07:00
2023-09-06 09:24:25 -07:00
2023-09-01 16:54:25 -07:00
2023-09-04 13:52:58 -07:00
2023-08-31 12:43:10 -07:00
2023-08-29 09:47:33 -07:00
2023-09-01 09:38:00 -07:00
2023-09-04 13:47:59 -07:00
2023-08-30 18:32:24 -07:00
2023-09-14 16:20:31 -06:00
2023-08-30 16:59:03 -07:00
2023-08-18 10:55:49 +05:30
2023-09-09 11:35:28 -07:00
2023-09-08 12:48:37 -07:00
2023-09-03 10:38:02 -07:00
2023-09-07 18:05:58 -07:00
2023-09-07 15:51:07 -07:00
2023-09-04 15:12:26 -07:00
2023-09-04 15:08:52 -07:00
2023-09-07 16:07:35 -07:00
2023-09-08 21:39:54 -07:00
2023-09-03 10:20:57 -07:00
2023-09-07 15:49:20 -07:00
2023-09-01 09:38:00 -07:00
2023-09-04 10:43:44 -07:00
2023-08-30 20:41:37 -07:00
2023-09-06 09:00:37 -07:00
2023-08-24 16:20:18 -07:00
2023-09-06 09:19:12 -07:00
2023-08-29 20:32:10 -07:00
2023-08-21 13:27:44 +02:00