mirror of
https://github.com/torvalds/linux.git
synced 2026-01-25 15:03:52 +08:00
rpmsg: Use strscpy() instead of strscpy_pad()
kzalloc() already zero-initializes the destination buffer, making strscpy() sufficient for safely copying the name. The additional NUL- padding performed by strscpy_pad() is unnecessary. The size parameter is optional, and strscpy() automatically determines the size of the destination buffer using sizeof() when the argument is omitted. RPMSG_NAME_SIZE is equal to sizeof(rpdev->id.name) and can be removed - remove it. No functional changes intended. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Link: https://lore.kernel.org/r/20250429104543.66927-2-thorsten.blum@linux.dev Signed-off-by: Bjorn Andersson <andersson@kernel.org>
This commit is contained in:
committed by
Bjorn Andersson
parent
214ae22e6d
commit
c8a8df494f
@@ -1663,7 +1663,7 @@ static int qcom_glink_rx_open(struct qcom_glink *glink, unsigned int rcid,
|
||||
}
|
||||
|
||||
rpdev->ept = &channel->ept;
|
||||
strscpy_pad(rpdev->id.name, name, RPMSG_NAME_SIZE);
|
||||
strscpy(rpdev->id.name, name);
|
||||
rpdev->src = RPMSG_ADDR_ANY;
|
||||
rpdev->dst = RPMSG_ADDR_ANY;
|
||||
rpdev->ops = &glink_device_ops;
|
||||
|
||||
@@ -1089,7 +1089,7 @@ static int qcom_smd_create_device(struct qcom_smd_channel *channel)
|
||||
|
||||
/* Assign public information to the rpmsg_device */
|
||||
rpdev = &qsdev->rpdev;
|
||||
strscpy_pad(rpdev->id.name, channel->name, RPMSG_NAME_SIZE);
|
||||
strscpy(rpdev->id.name, channel->name);
|
||||
rpdev->src = RPMSG_ADDR_ANY;
|
||||
rpdev->dst = RPMSG_ADDR_ANY;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user