From 0b109c52b774354825771ac0f1ff93f18d989776 Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Mon, 13 May 2019 15:44:30 +0200 Subject: [PATCH] netdev: Add missing initialization ifaddr is not guaranteed to be initialized, I'm not sure why there was no compiler warning. Also replace a | with a || for boolean conditions and merge the wiphy check with that line. --- src/netdev.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/netdev.c b/src/netdev.c index 28983afe..f3620ac1 100644 --- a/src/netdev.c +++ b/src/netdev.c @@ -4347,7 +4347,7 @@ struct netdev *netdev_create_from_genl(struct l_genl_msg *msg) const void *data; const char *ifname = NULL; uint16_t ifname_len = 0; - const uint8_t *ifaddr; + const uint8_t *ifaddr = NULL; const uint32_t *ifindex = NULL, *iftype = NULL; struct netdev *netdev; struct wiphy *wiphy = NULL; @@ -4414,15 +4414,12 @@ struct netdev *netdev_create_from_genl(struct l_genl_msg *msg) } } - if (!wiphy) - return NULL; - if (!iftype) { l_warn("Missing iftype attribute"); return NULL; } - if (!ifindex || !ifaddr | !ifname) { + if (!wiphy || !ifindex || !ifaddr || !ifname) { l_warn("Unable to parse interface information"); return NULL; }