]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
net: dsa: lan9303: use ethtool_puts() for lan9303_get_strings()
authorJustin Stitt <justinstitt@google.com>
Thu, 25 Apr 2024 01:19:13 +0000 (01:19 +0000)
committerJakub Kicinski <kuba@kernel.org>
Fri, 26 Apr 2024 19:37:02 +0000 (12:37 -0700)
commit8880e2666fa87a7d62a60fea9fe9ed9ba21ddcf7
tree0e9b0fc6327b4502880b36a73a83d2164eb0815b
parentd5115a55ffb5253743346ddf628a890417e2935e
net: dsa: lan9303: use ethtool_puts() for lan9303_get_strings()

This pattern of strncpy with some pointer arithmetic setting fixed-sized
intervals with string literal data is a bit weird so let's use
ethtool_puts() as this has more obvious behavior and is less-error
prone.

Nicely, we also get to drop a usage of the now deprecated strncpy() [1].

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings
Link: https://github.com/KSPP/linux/issues/90
Suggested-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Justin Stitt <justinstitt@google.com>
Link: https://lore.kernel.org/r/20240425-strncpy-drivers-net-dsa-lan9303-core-c-v4-1-9fafd419d7bb@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/lan9303-core.c