From d6395f7ee711274fdfd71badde8c487289c1e1ea Mon Sep 17 00:00:00 2001 From: Ana Cabral Date: Fri, 7 Jan 2022 09:40:04 +0100 Subject: [PATCH] core/ovs: fix setting dpdk-devargs JSON to NULL NMSettingOvsDpdk does not have a verify() implementation that would prevent the devargs property from being NULL. We must thus anticipate and handle a NULL value. Fixes: ae4152120a0d ('ovs/ovsdb: add support for setting dpdk devargs option') --- src/core/devices/ovs/nm-ovsdb.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/devices/ovs/nm-ovsdb.c b/src/core/devices/ovs/nm-ovsdb.c index dfc0b2be82..1d59ea865e 100644 --- a/src/core/devices/ovs/nm-ovsdb.c +++ b/src/core/devices/ovs/nm-ovsdb.c @@ -753,6 +753,7 @@ _insert_interface(json_t *params, NMSettingOvsInterface *s_ovs_iface; NMSettingOvsDpdk *s_ovs_dpdk; NMSettingOvsPatch *s_ovs_patch; + char *dpdk_devargs; json_t *options = json_array(); json_t *row; guint32 mtu = 0; @@ -777,9 +778,11 @@ _insert_interface(json_t *params, s_ovs_patch = nm_connection_get_setting_ovs_patch(interface); if (s_ovs_dpdk) { - json_array_append_new( - options, - json_pack("[[s, s]]", "dpdk-devargs", nm_setting_ovs_dpdk_get_devargs(s_ovs_dpdk))); + dpdk_devargs = nm_setting_ovs_dpdk_get_devargs(s_ovs_dpdk); + if (dpdk_devargs) + json_array_append_new(options, json_pack("[[s, s]]", "dpdk-devargs", dpdk_devargs)); + else + json_array_append_new(options, json_array()); } else if (s_ovs_patch) { json_array_append_new( options,