summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2018-01-18 16:14:49 +0100
committerDavid S. Miller <davem@davemloft.net>2018-01-18 10:37:12 -0500
commitd680b3524cd2b9c4f1dc2ba1823c538988bb85e2 (patch)
treeccfe1762b1f8ae91e243b416e8ccf03bdb28c687
parent4f7d58517f461aa6e7b7509668f04021e089323d (diff)
downloadlinux-d680b3524cd2b9c4f1dc2ba1823c538988bb85e2.tar.bz2
net: sched: silence uninitialized parent variable warning in tc_dump_tfilter
When tcm->tcm_ifindex == TCM_IFINDEX_MAGIC_BLOCK, parent is still passed down but the value is never used. Compiler does not recognize it and issues a warning. Silence it down initializing parent to 0. Fixes: 7960d1daf278 ("net: sched: use block index as a handle instead of qdisc when block is shared") Reported-by: David Miller <davem@davemloft.net> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/sched/cls_api.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index e500d11da9cd..86d6e9d2cf00 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -1317,6 +1317,13 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
block = tcf_block_lookup(net, tcm->tcm_block_index);
if (!block)
goto out;
+ /* If we work with block index, q is NULL and parent value
+ * will never be used in the following code. The check
+ * in tcf_fill_node prevents it. However, compiler does not
+ * see that far, so set parent to zero to silence the warning
+ * about parent being uninitialized.
+ */
+ parent = 0;
} else {
const struct Qdisc_class_ops *cops;
struct net_device *dev;