Skip to content

Commit

Permalink
Merge tag 'rpmsg-v6.7' of git://git.kernel.org/pub/scm/linux/kernel/g…
Browse files Browse the repository at this point in the history
…it/remoteproc/linux

Pull rpmsg updates from Bjorn Andersson:
 "This replaces a number of strncpy() instances with strscpy() or
  strscpy_pad() through the rpmsg core and virtio implementation"

* tag 'rpmsg-v6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux:
  rpmsg: virtio: Replace deprecated strncpy with strscpy/_pad
  rpmsg: Replace deprecated strncpy with strscpy_pad
  rpmsg: core: Replace deprecated strncpy with strscpy
  • Loading branch information
torvalds committed Nov 8, 2023
2 parents d3fbdb8 + 2a6e483 commit c87271e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion drivers/rpmsg/rpmsg_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ static int rpmsg_dev_probe(struct device *dev)
goto out;

if (rpdrv->callback) {
strncpy(chinfo.name, rpdev->id.name, RPMSG_NAME_SIZE);
strscpy(chinfo.name, rpdev->id.name, sizeof(chinfo.name));
chinfo.src = rpdev->src;
chinfo.dst = RPMSG_ADDR_ANY;

Expand Down
2 changes: 1 addition & 1 deletion drivers/rpmsg/rpmsg_ns.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static int rpmsg_ns_cb(struct rpmsg_device *rpdev, void *data, int len,
/* don't trust the remote processor for null terminating the name */
msg->name[RPMSG_NAME_SIZE - 1] = '\0';

strncpy(chinfo.name, msg->name, sizeof(chinfo.name));
strscpy_pad(chinfo.name, msg->name, sizeof(chinfo.name));
chinfo.src = RPMSG_ADDR_ANY;
chinfo.dst = rpmsg32_to_cpu(rpdev, msg->addr);

Expand Down
6 changes: 3 additions & 3 deletions drivers/rpmsg/virtio_rpmsg_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ static int virtio_rpmsg_announce_create(struct rpmsg_device *rpdev)
virtio_has_feature(vrp->vdev, VIRTIO_RPMSG_F_NS)) {
struct rpmsg_ns_msg nsm;

strncpy(nsm.name, rpdev->id.name, RPMSG_NAME_SIZE);
strscpy_pad(nsm.name, rpdev->id.name, sizeof(nsm.name));
nsm.addr = cpu_to_rpmsg32(rpdev, rpdev->ept->addr);
nsm.flags = cpu_to_rpmsg32(rpdev, RPMSG_NS_CREATE);

Expand All @@ -353,7 +353,7 @@ static int virtio_rpmsg_announce_destroy(struct rpmsg_device *rpdev)
virtio_has_feature(vrp->vdev, VIRTIO_RPMSG_F_NS)) {
struct rpmsg_ns_msg nsm;

strncpy(nsm.name, rpdev->id.name, RPMSG_NAME_SIZE);
strscpy_pad(nsm.name, rpdev->id.name, sizeof(nsm.name));
nsm.addr = cpu_to_rpmsg32(rpdev, rpdev->ept->addr);
nsm.flags = cpu_to_rpmsg32(rpdev, RPMSG_NS_DESTROY);

Expand Down Expand Up @@ -424,7 +424,7 @@ static struct rpmsg_device *__rpmsg_create_channel(struct virtproc_info *vrp,
*/
rpdev->announce = rpdev->src != RPMSG_ADDR_ANY;

strncpy(rpdev->id.name, chinfo->name, RPMSG_NAME_SIZE);
strscpy(rpdev->id.name, chinfo->name, sizeof(rpdev->id.name));

rpdev->dev.parent = &vrp->vdev->dev;
rpdev->dev.release = virtio_rpmsg_release_device;
Expand Down

0 comments on commit c87271e

Please sign in to comment.