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

Configure Feed

Select the types of activity you want to include in your feed.

team: avoid using variable-length array

Apparently using variable-length array is not correct
(https://lkml.org/lkml/2011/10/23/25). So remove it.

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
2bba19ff 234a8fd4

+7 -2
+7 -2
drivers/net/team/team.c
··· 96 96 size_t option_count) 97 97 { 98 98 int i; 99 - struct team_option *dst_opts[option_count]; 99 + struct team_option **dst_opts; 100 100 int err; 101 101 102 - memset(dst_opts, 0, sizeof(dst_opts)); 102 + dst_opts = kzalloc(sizeof(struct team_option *) * option_count, 103 + GFP_KERNEL); 104 + if (!dst_opts) 105 + return -ENOMEM; 103 106 for (i = 0; i < option_count; i++, option++) { 104 107 struct team_option *dst_opt; 105 108 ··· 122 119 for (i = 0; i < option_count; i++) 123 120 list_add_tail(&dst_opts[i]->list, &team->option_list); 124 121 122 + kfree(dst_opts); 125 123 return 0; 126 124 127 125 rollback: 128 126 for (i = 0; i < option_count; i++) 129 127 kfree(dst_opts[i]); 130 128 129 + kfree(dst_opts); 131 130 return err; 132 131 } 133 132