On Fri, Dec 07, 2018 at 02:58:30PM +0100, Sven Eckelmann wrote: [...]
The BATADV_CMD_GET_HARDIFS (or short version BATADV_CMD_GET_HARDIF) is reused as get command because it already allow to dump the content of other information from the slave/hard-interface which are not yet configuration specific.
"already allow" -> "already allows"
[...]
@@ -76,6 +77,13 @@ enum batadv_genl_ops_flags { * safed in info->user_ptr[0] */ BATADV_FLAG_NEED_MESH = BIT(0),
- /**
* @BATADV_FLAG_NEED_HARDIF: request requires valid hard interface in
* attribute BATADV_ATTR_HARD_IFINDEX and expects a pointer to it to be
* safed in info->user_ptr[1]
*/
- BATADV_FLAG_NEED_HARDIF = BIT(1),
safed -> saved (and same in the previous patch)
[...]
/**
- batadv_pre_doit() - Prepare batman-adv genl doit request
- @ops: requested netlink operation
@@ -592,7 +738,16 @@ batadv_get_softif_from_info(struct net *net, struct genl_info *info) static int batadv_pre_doit(const struct genl_ops *ops, struct sk_buff *skb, struct genl_info *info) {
- struct batadv_priv *bat_priv;
- struct batadv_hard_iface *hard_iface;
- struct batadv_priv *bat_priv = NULL;
- int ret;
- if (WARN_ON(ops->internal_flags & BATADV_FLAG_NEED_HARDIF))
return -EINVAL;
- if (WARN_ON((ops->internal_flags & BATADV_FLAG_NEED_HARDIF) &&
(~ops->internal_flags & BATADV_FLAG_NEED_MESH)))
return -EINVAL;
Seems like the second part is unreachable code. If BATADV_FLAG_NEED_HARDIF is set then the function returns with the first if-clause already.