3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

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:
Andrew Zaborowski 2019-05-13 15:44:30 +02:00 committed by Denis Kenzior
parent b86af171f0
commit 0b109c52b7

View File

@ -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;
}