From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cong Wang Date: Wed, 28 Oct 2020 17:38:45 +0000 Subject: Re: [PATCH] net: cls_api: remove unneeded local variable in tc_dump_chain() Message-Id: List-Id: References: <20201028113533.26160-1-lukas.bulwahn@gmail.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Tom Rix Cc: Lukas Bulwahn , Jamal Hadi Salim , Jiri Pirko , "David S . Miller" , Jakub Kicinski , Linux Kernel Network Developers , Nathan Chancellor , Nick Desaulniers , clang-built-linux@googlegroups.com, LKML , kernel-janitors@vger.kernel.org, linux-safety@lists.elisa.tech On Wed, Oct 28, 2020 at 6:59 AM Tom Rix wrote: > > > On 10/28/20 4:35 AM, Lukas Bulwahn wrote: > > @@ -2971,13 +2963,11 @@ static int tc_dump_chain(struct sk_buff *skb, struct netlink_callback *cb) > > if (!dev) > > return skb->len; > > > > - parent = tcm->tcm_parent; > > - if (!parent) { > > + if (!tcm->tcm_parent) > > q = dev->qdisc; > > - parent = q->handle; > > This looks like a an unused error handler. > > and the later call to > > if (TC_H_MIN(tcm->tcm_parent) > > maybe should be > > if (TC_H_MIN(parent)) When tcm->tcm_parent is 0, TC_H_MIN(tcm->tcm_parent) is also 0, so we will not hit that if branch. So, I think Lukas' patch is correct. Thanks.