summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinghao Chi <chi.minghao@zte.com.cn>2022-09-21 02:16:17 +0000
committerDavid S. Miller <davem@davemloft.net>2022-09-23 12:03:35 +0100
commitf948ac2313336d059b13ee0dee4840a1fb317fe9 (patch)
tree08084d30069ee88cfed91298b59adf3da2764472
parente19de30d20809af3221ef8a2648b8a8a52e02d90 (diff)
xen-netback: use kstrdup instead of open-coding it
use kstrdup instead of open-coding it. Reported-by: Zeal Robot <zealci@zte.com.cn> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn> Acked-by: Wei Liu <wei.liu@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/xen-netback/xenbus.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index e85b3c5d4acc..c1ba4294f364 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -865,13 +865,12 @@ static int connect_data_rings(struct backend_info *be,
* queue-N.
*/
if (num_queues == 1) {
- xspath = kzalloc(strlen(dev->otherend) + 1, GFP_KERNEL);
+ xspath = kstrdup(dev->otherend, GFP_KERNEL);
if (!xspath) {
xenbus_dev_fatal(dev, -ENOMEM,
"reading ring references");
return -ENOMEM;
}
- strcpy(xspath, dev->otherend);
} else {
xspathsize = strlen(dev->otherend) + xenstore_path_ext_size;
xspath = kzalloc(xspathsize, GFP_KERNEL);