commit 0b109c52b774354825771ac0f1ff93f18d989776
parent b86af171f08a92f775cb92a4e347fd6f93a38815
Author: Andrew Zaborowski <andrew.zaborowski@intel.com>
Date: Mon, 13 May 2019 15:44:30 +0200
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.
Diffstat:
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git 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;
}