Skip to content

Commit

Permalink
net: sched: gred: remove NULL check before free table->tab in gred_de…
Browse files Browse the repository at this point in the history
…stroy()

The kfree invoked by gred_destroy_vq checks whether the input parameter
is empty. Therefore, gred_destroy() doesn't need to check table->tab.

Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Link: https://lore.kernel.org/r/20220831041452.33026-1-shaozhengchao@huawei.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Zhengchao Shao authored and Paolo Abeni committed Sep 1, 2022
1 parent 2af39b9 commit 4bf8594
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions net/sched/sch_gred.c
Original file line number Diff line number Diff line change
Expand Up @@ -908,10 +908,9 @@ static void gred_destroy(struct Qdisc *sch)
struct gred_sched *table = qdisc_priv(sch);
int i;

for (i = 0; i < table->DPs; i++) {
if (table->tab[i])
gred_destroy_vq(table->tab[i]);
}
for (i = 0; i < table->DPs; i++)
gred_destroy_vq(table->tab[i]);

gred_offload(sch, TC_GRED_DESTROY);
kfree(table->opt);
}
Expand Down

0 comments on commit 4bf8594

Please sign in to comment.