Commit af4f8ba4 authored by Thomas Haller's avatar Thomas Haller Committed by Lubomir Rintel

platform: assert for out-of-memory in netlink code

These lines can be reached if the allocated buffer is too
small to hold the netlink message. That is actually a bug
that we need to fix. Assert.

(cherry picked from commit 3784a2a2)
parent 3bf538a3
...@@ -3681,7 +3681,7 @@ _nl_msg_new_link_set_afspec (struct nl_msg *msg, ...@@ -3681,7 +3681,7 @@ _nl_msg_new_link_set_afspec (struct nl_msg *msg,
return TRUE; return TRUE;
nla_put_failure: nla_put_failure:
return FALSE; g_return_val_if_reached (FALSE);
} }
static gboolean static gboolean
...@@ -3832,7 +3832,7 @@ _nl_msg_new_link_set_linkinfo_vlan (struct nl_msg *msg, ...@@ -3832,7 +3832,7 @@ _nl_msg_new_link_set_linkinfo_vlan (struct nl_msg *msg,
return TRUE; return TRUE;
nla_put_failure: nla_put_failure:
return FALSE; g_return_val_if_reached (FALSE);
} }
static struct nl_msg * static struct nl_msg *
...@@ -4278,7 +4278,7 @@ _add_action_simple (struct nl_msg *msg, ...@@ -4278,7 +4278,7 @@ _add_action_simple (struct nl_msg *msg,
return TRUE; return TRUE;
nla_put_failure: nla_put_failure:
return FALSE; g_return_val_if_reached (FALSE);
} }
static gboolean static gboolean
...@@ -4308,7 +4308,7 @@ _add_action_mirred (struct nl_msg *msg, ...@@ -4308,7 +4308,7 @@ _add_action_mirred (struct nl_msg *msg,
return TRUE; return TRUE;
nla_put_failure: nla_put_failure:
return FALSE; g_return_val_if_reached (FALSE);
} }
static gboolean static gboolean
...@@ -4334,7 +4334,7 @@ _add_action (struct nl_msg *msg, ...@@ -4334,7 +4334,7 @@ _add_action (struct nl_msg *msg,
return TRUE; return TRUE;
nla_put_failure: nla_put_failure:
return FALSE; g_return_val_if_reached (FALSE);
} }
static struct nl_msg * static struct nl_msg *
......
...@@ -103,7 +103,7 @@ _nl80211_alloc_msg (int id, int ifindex, int phy, guint32 cmd, guint32 flags) ...@@ -103,7 +103,7 @@ _nl80211_alloc_msg (int id, int ifindex, int phy, guint32 cmd, guint32 flags)
return g_steal_pointer (&msg); return g_steal_pointer (&msg);
nla_put_failure: nla_put_failure:
return NULL; g_return_val_if_reached (NULL);
} }
static struct nl_msg * static struct nl_msg *
...@@ -250,7 +250,7 @@ wifi_nl80211_set_mode (NMWifiUtils *data, const NM80211Mode mode) ...@@ -250,7 +250,7 @@ wifi_nl80211_set_mode (NMWifiUtils *data, const NM80211Mode mode)
return err >= 0; return err >= 0;
nla_put_failure: nla_put_failure:
return FALSE; g_return_val_if_reached (FALSE);
} }
static gboolean static gboolean
...@@ -267,7 +267,7 @@ wifi_nl80211_set_powersave (NMWifiUtils *data, guint32 powersave) ...@@ -267,7 +267,7 @@ wifi_nl80211_set_powersave (NMWifiUtils *data, guint32 powersave)
return err >= 0; return err >= 0;
nla_put_failure: nla_put_failure:
return FALSE; g_return_val_if_reached (FALSE);
} }
static int static int
...@@ -365,7 +365,7 @@ wifi_nl80211_set_wake_on_wlan (NMWifiUtils *data, NMSettingWirelessWakeOnWLan wo ...@@ -365,7 +365,7 @@ wifi_nl80211_set_wake_on_wlan (NMWifiUtils *data, NMSettingWirelessWakeOnWLan wo
return err >= 0; return err >= 0;
nla_put_failure: nla_put_failure:
return FALSE; g_return_val_if_reached (FALSE);
} }
/* @divisor: pass what value @xbm should be divided by to get dBm */ /* @divisor: pass what value @xbm should be divided by to get dBm */
...@@ -642,7 +642,7 @@ nl80211_get_ap_info (NMWifiUtilsNl80211 *self, ...@@ -642,7 +642,7 @@ nl80211_get_ap_info (NMWifiUtilsNl80211 *self,
return; return;
nla_put_failure: nla_put_failure:
return; g_return_if_reached ();
} }
static guint32 static guint32
...@@ -695,7 +695,7 @@ wifi_nl80211_indicate_addressing_running (NMWifiUtils *data, gboolean running) ...@@ -695,7 +695,7 @@ wifi_nl80211_indicate_addressing_running (NMWifiUtils *data, gboolean running)
return err >= 0; return err >= 0;
nla_put_failure: nla_put_failure:
return FALSE; g_return_val_if_reached (FALSE);
} }
struct nl80211_device_info { struct nl80211_device_info {
......
...@@ -92,7 +92,7 @@ _nl802154_alloc_msg (int id, int ifindex, guint32 cmd, guint32 flags) ...@@ -92,7 +92,7 @@ _nl802154_alloc_msg (int id, int ifindex, guint32 cmd, guint32 flags)
return g_steal_pointer (&msg); return g_steal_pointer (&msg);
nla_put_failure: nla_put_failure:
return NULL; g_return_val_if_reached (NULL);
} }
static struct nl_msg * static struct nl_msg *
...@@ -217,7 +217,7 @@ nm_wpan_utils_set_pan_id (NMWpanUtils *self, guint16 pan_id) ...@@ -217,7 +217,7 @@ nm_wpan_utils_set_pan_id (NMWpanUtils *self, guint16 pan_id)
return err >= 0; return err >= 0;
nla_put_failure: nla_put_failure:
return FALSE; g_return_val_if_reached (FALSE);
} }
guint16 guint16
...@@ -244,7 +244,7 @@ nm_wpan_utils_set_short_addr (NMWpanUtils *self, guint16 short_addr) ...@@ -244,7 +244,7 @@ nm_wpan_utils_set_short_addr (NMWpanUtils *self, guint16 short_addr)
return err >= 0; return err >= 0;
nla_put_failure: nla_put_failure:
return FALSE; g_return_val_if_reached (FALSE);
} }
gboolean gboolean
...@@ -262,7 +262,7 @@ nm_wpan_utils_set_channel (NMWpanUtils *self, guint8 page, guint8 channel) ...@@ -262,7 +262,7 @@ nm_wpan_utils_set_channel (NMWpanUtils *self, guint8 page, guint8 channel)
return err >= 0; return err >= 0;
nla_put_failure: nla_put_failure:
return FALSE; g_return_val_if_reached (FALSE);
} }
/*****************************************************************************/ /*****************************************************************************/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment