Commit f948ac23 authored by Minghao Chi's avatar Minghao Chi Committed by David S. Miller

xen-netback: use kstrdup instead of open-coding it

use kstrdup instead of open-coding it.
Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
Signed-off-by: default avatarMinghao Chi <chi.minghao@zte.com.cn>
Acked-by: default avatarWei Liu <wei.liu@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e19de30d
...@@ -865,13 +865,12 @@ static int connect_data_rings(struct backend_info *be, ...@@ -865,13 +865,12 @@ static int connect_data_rings(struct backend_info *be,
* queue-N. * queue-N.
*/ */
if (num_queues == 1) { if (num_queues == 1) {
xspath = kzalloc(strlen(dev->otherend) + 1, GFP_KERNEL); xspath = kstrdup(dev->otherend, GFP_KERNEL);
if (!xspath) { if (!xspath) {
xenbus_dev_fatal(dev, -ENOMEM, xenbus_dev_fatal(dev, -ENOMEM,
"reading ring references"); "reading ring references");
return -ENOMEM; return -ENOMEM;
} }
strcpy(xspath, dev->otherend);
} else { } else {
xspathsize = strlen(dev->otherend) + xenstore_path_ext_size; xspathsize = strlen(dev->otherend) + xenstore_path_ext_size;
xspath = kzalloc(xspathsize, GFP_KERNEL); xspath = kzalloc(xspathsize, GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment