lkml.org 
[lkml]   [2022]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] rpmsg: strcpy is not safe, use strncpy
Date
Replace strcpy with strncpy for copying the rpmsg
device name in rpmsg_register_device_override

Signed-off-by: Saud Farooqui <farooqui_saud@hotmail.com>
---
drivers/rpmsg/rpmsg_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
index 290c1f02da10..d3b29c19715d 100644
--- a/drivers/rpmsg/rpmsg_core.c
+++ b/drivers/rpmsg/rpmsg_core.c
@@ -604,7 +604,7 @@ int rpmsg_register_device_override(struct rpmsg_device *rpdev,
int ret;

if (driver_override)
- strcpy(rpdev->id.name, driver_override);
+ strncpy(rpdev->id.name, driver_override, sizeof(rpdev->id.name));

dev_set_name(dev, "%s.%s.%d.%d", dev_name(dev->parent),
rpdev->id.name, rpdev->src, rpdev->dst);
--
2.25.1
\
 
 \ /
  Last update: 2022-06-08 20:44    [W:0.120 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site