Message ID | 20231019-strncpy-drivers-net-wwan-rpmsg_wwan_ctrl-c-v2-1-ecf9b5a39430@google.com (mailing list archive) |
---|---|
State | Mainlined |
Commit | 75e7d0b2d22370c83c6dcb0cedbd0cca74383b5e |
Headers | show |
Series | [v2] net: wwan: replace deprecated strncpy with strscpy | expand |
Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <kuba@kernel.org>: On Thu, 19 Oct 2023 18:21:22 +0000 you wrote: > strncpy() is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > We expect chinfo.name to be NUL-terminated based on its use with format > strings and sprintf: > rpmsg/rpmsg_char.c > 165: dev_err(dev, "failed to open %s\n", eptdev->chinfo.name); > 368: return sprintf(buf, "%s\n", eptdev->chinfo.name); > > [...] Here is the summary with links: - [v2] net: wwan: replace deprecated strncpy with strscpy https://git.kernel.org/netdev/net-next/c/75e7d0b2d223 You are awesome, thank you!
diff --git a/drivers/net/wwan/rpmsg_wwan_ctrl.c b/drivers/net/wwan/rpmsg_wwan_ctrl.c index 86b60aadfa11..26756ff0e44d 100644 --- a/drivers/net/wwan/rpmsg_wwan_ctrl.c +++ b/drivers/net/wwan/rpmsg_wwan_ctrl.c @@ -37,7 +37,7 @@ static int rpmsg_wwan_ctrl_start(struct wwan_port *port) .dst = RPMSG_ADDR_ANY, }; - strncpy(chinfo.name, rpwwan->rpdev->id.name, RPMSG_NAME_SIZE); + strscpy(chinfo.name, rpwwan->rpdev->id.name, sizeof(chinfo.name)); rpwwan->ept = rpmsg_create_ept(rpwwan->rpdev, rpmsg_wwan_ctrl_callback, rpwwan, chinfo); if (!rpwwan->ept)