From: Peter Krempa Date: Mon, 5 Sep 2022 14:22:47 +0000 (+0200) Subject: util: netdev: Dynamically allocate 'struct nlattr' in virNetDevSwitchdevFeature X-Git-Tag: v8.8.0-rc1~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89c7ff156bb34738b56acf970e13c6117b672e43;p=thirdparty%2Flibvirt.git util: netdev: Dynamically allocate 'struct nlattr' in virNetDevSwitchdevFeature At time of writing DEVLINK_ATTR_MAX equals to 176, thus the stack'd size of the pointer array is almost 1.4kiB. Allocate it dynamically. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 6c6f6dee42..66cfc5d781 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -3210,7 +3210,7 @@ virNetDevSwitchdevFeature(const char *ifname, struct nl_msg *nl_msg = NULL; g_autofree struct nlmsghdr *resp = NULL; unsigned int recvbuflen; - struct nlattr *tb[DEVLINK_ATTR_MAX + 1] = {NULL, }; + g_autofree struct nlattr **tb = g_new0(struct nlattr *, DEVLINK_ATTR_MAX + 1); g_autoptr(virPCIDevice) pci_device_ptr = NULL; struct genlmsghdr gmsgh = { .cmd = DEVLINK_CMD_ESWITCH_GET,