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.
This commit is contained in:
parent
b86af171f0
commit
0b109c52b7
|
@ -4347,7 +4347,7 @@ struct netdev *netdev_create_from_genl(struct l_genl_msg *msg)
|
||||||
const void *data;
|
const void *data;
|
||||||
const char *ifname = NULL;
|
const char *ifname = NULL;
|
||||||
uint16_t ifname_len = 0;
|
uint16_t ifname_len = 0;
|
||||||
const uint8_t *ifaddr;
|
const uint8_t *ifaddr = NULL;
|
||||||
const uint32_t *ifindex = NULL, *iftype = NULL;
|
const uint32_t *ifindex = NULL, *iftype = NULL;
|
||||||
struct netdev *netdev;
|
struct netdev *netdev;
|
||||||
struct wiphy *wiphy = NULL;
|
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) {
|
if (!iftype) {
|
||||||
l_warn("Missing iftype attribute");
|
l_warn("Missing iftype attribute");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ifindex || !ifaddr | !ifname) {
|
if (!wiphy || !ifindex || !ifaddr || !ifname) {
|
||||||
l_warn("Unable to parse interface information");
|
l_warn("Unable to parse interface information");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue