From: Arnd Bergmann <arnd@arndb.de>
To: Jamal Hadi Salim <jhs@mojatatu.com>,
Cong Wang <xiyou.wangcong@gmail.com>,
Jiri Pirko <jiri@resnulli.us>,
"David S. Miller" <davem@davemloft.net>
Cc: Arnd Bergmann <arnd@arndb.de>,
David Ahern <dsa@cumulusnetworks.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] [net-next] net: sched: avoid uninitialized variable use
Date: Thu, 18 Jan 2018 14:17:28 +0100 [thread overview]
Message-ID: <20180118131747.920324-1-arnd@arndb.de> (raw)
gcc has identified a code path in which we pass uninitialized
data into tc_dump_tfilter():
net/sched/cls_api.c: In function 'tc_dump_tfilter':
net/sched/cls_api.c:1268:8: error: 'parent' may be used uninitialized in this function [-Werror=maybe-uninitialized]
This initializes the variable to the value it had before the previous
change.
Fixes: 7960d1daf278 ("net: sched: use block index as a handle instead of qdisc when block is shared")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
----
I don't know if my patch is the best way to address the issue, but
if not, then at least it helps show what the warning is about
and lets someone else come up with a better solution.
---
net/sched/cls_api.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index e500d11da9cd..a95bfc8fc442 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -1317,6 +1317,7 @@ 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;
+ parent = tcm->tcm_parent;
} else {
const struct Qdisc_class_ops *cops;
struct net_device *dev;
--
2.9.0
next reply other threads:[~2018-01-18 13:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-18 13:17 Arnd Bergmann [this message]
2018-01-18 13:49 ` [PATCH] [net-next] net: sched: avoid uninitialized variable use Jiri Pirko
2018-01-18 14:19 ` Arnd Bergmann
2018-01-18 14:32 ` Jiri Pirko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180118131747.920324-1-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=dsa@cumulusnetworks.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=xiyou.wangcong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox