All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: drop_monitor: Use kstrdup
@ 2020-01-28 19:02 Joe Perches
  2020-01-30  9:03 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Perches @ 2020-01-28 19:02 UTC (permalink / raw)
  To: Neil Horman; +Cc: David S. Miller, Jakub Kicinski, netdev, linux-kernel

Convert the equivalent but rather odd uses of kmemdup with
__GFP_ZERO to the more common kstrdup and avoid unnecessary
zeroing of copied over memory.

Signed-off-by: Joe Perches <joe@perches.com>
---
 net/core/drop_monitor.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
index 536e032..ea46fc 100644
--- a/net/core/drop_monitor.c
+++ b/net/core/drop_monitor.c
@@ -802,16 +802,12 @@ net_dm_hw_metadata_clone(const struct net_dm_hw_metadata *hw_metadata)
 	if (!n_hw_metadata)
 		return NULL;
 
-	trap_group_name = kmemdup(hw_metadata->trap_group_name,
-				  strlen(hw_metadata->trap_group_name) + 1,
-				  GFP_ATOMIC | __GFP_ZERO);
+	trap_group_name = kstrdup(hw_metadata->trap_group_name, GFP_ATOMIC);
 	if (!trap_group_name)
 		goto free_hw_metadata;
 	n_hw_metadata->trap_group_name = trap_group_name;
 
-	trap_name = kmemdup(hw_metadata->trap_name,
-			    strlen(hw_metadata->trap_name) + 1,
-			    GFP_ATOMIC | __GFP_ZERO);
+	trap_name = kstrdup(hw_metadata->trap_name, GFP_ATOMIC);
 	if (!trap_name)
 		goto free_trap_group;
 	n_hw_metadata->trap_name = trap_name;



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: drop_monitor: Use kstrdup
  2020-01-28 19:02 [PATCH] net: drop_monitor: Use kstrdup Joe Perches
@ 2020-01-30  9:03 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-01-30  9:03 UTC (permalink / raw)
  To: joe; +Cc: nhorman, kuba, netdev, linux-kernel

From: Joe Perches <joe@perches.com>
Date: Tue, 28 Jan 2020 11:02:50 -0800

> Convert the equivalent but rather odd uses of kmemdup with
> __GFP_ZERO to the more common kstrdup and avoid unnecessary
> zeroing of copied over memory.
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-30  9:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-28 19:02 [PATCH] net: drop_monitor: Use kstrdup Joe Perches
2020-01-30  9:03 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.