Skip to content

Commit 72d62c4

Browse files
JoePerchesdavem330
authored andcommitted
net: drop_monitor: Use kstrdup
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d0208bf commit 72d62c4

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

net/core/drop_monitor.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -802,16 +802,12 @@ net_dm_hw_metadata_clone(const struct net_dm_hw_metadata *hw_metadata)
802802
if (!n_hw_metadata)
803803
return NULL;
804804

805-
trap_group_name = kmemdup(hw_metadata->trap_group_name,
806-
strlen(hw_metadata->trap_group_name) + 1,
807-
GFP_ATOMIC | __GFP_ZERO);
805+
trap_group_name = kstrdup(hw_metadata->trap_group_name, GFP_ATOMIC);
808806
if (!trap_group_name)
809807
goto free_hw_metadata;
810808
n_hw_metadata->trap_group_name = trap_group_name;
811809

812-
trap_name = kmemdup(hw_metadata->trap_name,
813-
strlen(hw_metadata->trap_name) + 1,
814-
GFP_ATOMIC | __GFP_ZERO);
810+
trap_name = kstrdup(hw_metadata->trap_name, GFP_ATOMIC);
815811
if (!trap_name)
816812
goto free_trap_group;
817813
n_hw_metadata->trap_name = trap_name;

0 commit comments

Comments
 (0)