Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 65a7a5ee authored by Greg Hackmann's avatar Greg Hackmann Committed by Amit Pundir
Browse files

ANDROID: netfilter: xt_qtaguid: don't check if embedded arrays are NULL



clang warns about four NULL pointer checks:

net/netfilter/xt_qtaguid.c:973:11: warning: address of array 'ifa->ifa_label' will always evaluate to 'true' [-Wpointer-bool-conversion]
net/netfilter/xt_qtaguid.c:974:13: warning: address of array 'ifa->ifa_label' will always evaluate to 'true' [-Wpointer-bool-conversion]
net/netfilter/xt_qtaguid.c:1212:31: warning: address of array 'el_dev->name' will always evaluate to 'true' [-Wpointer-bool-conversion]
net/netfilter/xt_qtaguid.c:1640:31: warning: address of array 'el_dev->name' will always evaluate to 'true' [-Wpointer-bool-conversion]

Both of these fields are embedded char[16] arrays rather than pointers,
so they can never be NULL.

Change-Id: I748ff6dd11569e5596a9d5cecdf9c334847e7307
Signed-off-by: default avatarGreg Hackmann <ghackmann@google.com>
parent 8ccc999c
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -969,9 +969,8 @@ static void iface_stat_create(struct net_device *net_dev,
		for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) {
			IF_DEBUG("qtaguid: iface_stat: create(%s): "
				 "ifa=%p ifa_label=%s\n",
				 ifname, ifa,
				 ifa->ifa_label ? ifa->ifa_label : "(null)");
			if (ifa->ifa_label && !strcmp(ifname, ifa->ifa_label))
				 ifname, ifa, ifa->ifa_label);
			if (!strcmp(ifname, ifa->ifa_label))
				break;
		}
	}
@@ -1209,10 +1208,6 @@ static void iface_stat_update_from_skb(const struct sk_buff *skb,
		pr_err_ratelimited("qtaguid[%d]: %s(): no par->in/out?!!\n",
				   par->hooknum, __func__);
		BUG();
	} else if (unlikely(!el_dev->name)) {
		pr_err_ratelimited("qtaguid[%d]: %s(): no dev->name?!!\n",
				   par->hooknum, __func__);
		BUG();
	} else {
		proto = ipx_proto(skb, par);
		MT_DEBUG("qtaguid[%d]: dev name=%s type=%d fam=%d proto=%d\n",
@@ -1637,8 +1632,6 @@ static void account_for_uid(const struct sk_buff *skb,

	if (unlikely(!el_dev)) {
		pr_info("qtaguid[%d]: no par->in/out?!!\n", par->hooknum);
	} else if (unlikely(!el_dev->name)) {
		pr_info("qtaguid[%d]: no dev->name?!!\n", par->hooknum);
	} else {
		int proto = ipx_proto(skb, par);
		MT_DEBUG("qtaguid[%d]: dev name=%s type=%d fam=%d proto=%d\n",