Skip to contentSkip to conversation

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

PATCH Applied [email protected] 3 participants 3 messages Sep 21, 2022 – Sep 23, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen-netback: use kstrdup instead of open-coding it

From: Minghao Chi <[email protected]>

use kstrdup instead of open-coding it.

---
 drivers/net/xen-netback/xenbus.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/xen-netback/xenbus.c +1 -2
index e85b3c5d4acc..c1ba4294f364 100644
@@ -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);
Signature · 1 line
2.25.1
#2 lore raw
In reply to [email protected]
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Quoted 8 lines · On Wed, 21 Sep 2022 02:16:17 +0000 you wrote:

From: Minghao Chi <[email protected]>

use kstrdup instead of open-coding it.

[...]

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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html