Skip to contentSkip to conversation

wwan_hwsim: Use skb_put_data() instead of skb_put/memcpy pair

PATCH Applied Shang XiaoJing 2 participants 2 messages Sep 27, 2022 – Sep 29, 2022

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

PATCH 1/1 wwan_hwsim: Use skb_put_data() instead of skb_put/memcpy pair

Use skb_put_data() instead of skb_put() and memcpy(), which is clear.

---
 drivers/net/wwan/wwan_hwsim.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wwan/wwan_hwsim.c +3 -3
index fad642f9ffd8..ff09a8cedf93 100644
@@ -157,8 +157,8 @@ static int wwan_hwsim_port_tx(struct wwan_port *wport, struct sk_buff *in)
 			if ((i + 1) < in->len && in->data[i + 1] == '\n')
 				i++;
 			n = i - s + 1;
-			memcpy(skb_put(out, n), &in->data[s], n);/* Echo */
-			memcpy(skb_put(out, 6), "\r\nOK\r\n", 6);
+			skb_put_data(out, &in->data[s], n);/* Echo */
+			skb_put_data(out, "\r\nOK\r\n", 6);
 			s = i + 1;
 			port->pstate = AT_PARSER_WAIT_A;
 		} else if (port->pstate == AT_PARSER_SKIP_LINE) {
@@ -171,7 +171,7 @@ static int wwan_hwsim_port_tx(struct wwan_port *wport, struct sk_buff *in)
 	if (i > s) {
 		/* Echo the processed portion of a not yet completed command */
 		n = i - s;
-		memcpy(skb_put(out, n), &in->data[s], n);
+		skb_put_data(out, &in->data[s], n);
 	}
 
 	consume_skb(in);
Signature · 1 line
2.17.1
#1 lore raw
This patch was applied to netdev/net-next.git (master) by Paolo Abeni <[email protected]>:

Hello:

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

Quoted 6 lines · On Tue, 27 Sep 2022 10:45:11 +0800 you wrote:

Use skb_put_data() instead of skb_put() and memcpy(), which is clear.

---
 drivers/net/wwan/wwan_hwsim.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Here is the summary with links:
- [-next] wwan_hwsim: Use skb_put_data() instead of skb_put/memcpy pair

    https://git.kernel.org/netdev/net-next/c/6db239f01abc

You are awesome, thank you!

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