From 243458836adcdb4652bcb5871b53e6f65b510985 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 1 Aug 2019 17:48:48 +0200 Subject: [PATCH] platform: avoid coverity warning about not checking nla_nest_start() result Usually we check the result of nla_nest_start(). Also, in most cases where this function would return %NULL, it's an actual bug. That is, because our netlink message is allocated with a large buffer, and in most cases we append there a well known, small amount of data. To make coverity happy, handle the case and assert. --- src/platform/wifi/nm-wifi-utils-nl80211.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/platform/wifi/nm-wifi-utils-nl80211.c b/src/platform/wifi/nm-wifi-utils-nl80211.c index c4a8bd8a7..2f30b05a2 100644 --- a/src/platform/wifi/nm-wifi-utils-nl80211.c +++ b/src/platform/wifi/nm-wifi-utils-nl80211.c @@ -347,6 +347,8 @@ wifi_nl80211_set_wake_on_wlan (NMWifiUtils *data, NMSettingWirelessWakeOnWLan wo return FALSE; triggers = nla_nest_start (msg, NL80211_ATTR_WOWLAN_TRIGGERS); + if (!triggers) + goto nla_put_failure; if (NM_FLAGS_HAS (wowl, NM_SETTING_WIRELESS_WAKE_ON_WLAN_ANY)) NLA_PUT_FLAG (msg, NL80211_WOWLAN_TRIG_ANY);