aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorZhou Jie <zhoujie2011@cn.fujitsu.com>2016-04-26 09:26:01 +0800
committerJason Wang <jasowang@redhat.com>2016-05-25 15:46:07 +0800
commit11196e95f0521fa6ba689c15f874ad9a2d99e158 (patch)
tree1169e203361f6b400edca6dc61ef72105105756d /net
parent287db79df8af8e31f18e262feb5e05103a09e4d4 (diff)
net/tap: Allocating Large sized arrays to heap
net_init_tap has a huge stack usage of 8192 bytes approx. Moving large arrays to heap to reduce stack usage. Signed-off-by: Zhou Jie <zhoujie2011@cn.fujitsu.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'net')
-rw-r--r--net/tap.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/tap.c b/net/tap.c
index 740e8a2613..49817c70c1 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -769,8 +769,8 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
return -1;
}
} else if (tap->has_fds) {
- char *fds[MAX_TAP_QUEUES];
- char *vhost_fds[MAX_TAP_QUEUES];
+ char **fds = g_new(char *, MAX_TAP_QUEUES);
+ char **vhost_fds = g_new(char *, MAX_TAP_QUEUES);
int nfds, nvhosts;
if (tap->has_ifname || tap->has_script || tap->has_downscript ||
@@ -818,6 +818,8 @@ int net_init_tap(const NetClientOptions *opts, const char *name,
return -1;
}
}
+ g_free(fds);
+ g_free(vhost_fds);
} else if (tap->has_helper) {
if (tap->has_ifname || tap->has_script || tap->has_downscript ||
tap->has_vnet_hdr || tap->has_queues || tap->has_vhostfds) {