[PATCH] xen-netback: use kstrdup instead of open-coding it

cgel.zte@gmail.com posted 1 patch 1 year, 7 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
drivers/net/xen-netback/xenbus.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] xen-netback: use kstrdup instead of open-coding it
Posted by cgel.zte@gmail.com 1 year, 7 months ago
From: Minghao Chi <chi.minghao@zte.com.cn>

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>
---
 drivers/net/xen-netback/xenbus.c | 3 +--
 1 file changed, 1 insertion(+), 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);
-- 
2.25.1
Re: [PATCH] xen-netback: use kstrdup instead of open-coding it
Posted by patchwork-bot+netdevbpf@kernel.org 1 year, 7 months ago
Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Wed, 21 Sep 2022 02:16:17 +0000 you wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> 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>
> 
> [...]

Here is the summary with links:
  - xen-netback: use kstrdup instead of open-coding it
    https://git.kernel.org/netdev/net-next/c/f948ac231333

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Re: [PATCH] xen-netback: use kstrdup instead of open-coding it
Posted by Wei Liu 1 year, 7 months ago
On Wed, Sep 21, 2022 at 02:16:17AM +0000, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> 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>