Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

team: replace kmalloc+memcpy by kmemdup

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jiri Pirko and committed by
David S. Miller
f8a15af0 2bba19ff

+2 -6
+2 -6
drivers/net/team/team.c
··· 104 104 if (!dst_opts) 105 105 return -ENOMEM; 106 106 for (i = 0; i < option_count; i++, option++) { 107 - struct team_option *dst_opt; 108 - 109 107 if (__team_find_option(team, option->name)) { 110 108 err = -EEXIST; 111 109 goto rollback; 112 110 } 113 - dst_opt = kmalloc(sizeof(*option), GFP_KERNEL); 114 - if (!dst_opt) { 111 + dst_opts[i] = kmemdup(option, sizeof(*option), GFP_KERNEL); 112 + if (!dst_opts[i]) { 115 113 err = -ENOMEM; 116 114 goto rollback; 117 115 } 118 - memcpy(dst_opt, option, sizeof(*option)); 119 - dst_opts[i] = dst_opt; 120 116 } 121 117 122 118 for (i = 0; i < option_count; i++)