From: Patrick McHardy <kaber@trash.net>
To: jamal <hadi@cyberus.ca>
Cc: Maillist netdev <netdev@oss.sgi.com>
Subject: [PATCH PKT_SCHED 3/17]: Remove checks for impossible conditions in act_api.c
Date: Thu, 30 Dec 2004 04:39:26 +0100 [thread overview]
Message-ID: <41D3786E.3070800@trash.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 135 bytes --]
Remove checks for impossible conditions, also remove some
useless NULL-ptr assignments and make loops iterating over
actions clearer.
[-- Attachment #2: 03.diff --]
[-- Type: text/x-patch, Size: 2975 bytes --]
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/12/30 01:36:55+01:00 kaber@coreworks.de
# [PKT_SCHED]: Remove checks for impossible conditions in act_api.c
#
# Also remove some useless NULL-ptr assignments and make loops iterating
# over actions clearer.
#
# Signed-off-by: Patrick McHardy <kaber@trash.net>
#
# net/sched/act_api.c
# 2004/12/30 01:36:48+01:00 kaber@coreworks.de +14 -32
# [PKT_SCHED]: Remove checks for impossible conditions in act_api.c
#
# Also remove some useless NULL-ptr assignments and make loops iterating
# over actions clearer.
#
# Signed-off-by: Patrick McHardy <kaber@trash.net>
#
diff -Nru a/net/sched/act_api.c b/net/sched/act_api.c
--- a/net/sched/act_api.c 2004-12-30 04:01:06 +01:00
+++ b/net/sched/act_api.c 2004-12-30 04:01:06 +01:00
@@ -195,25 +195,18 @@
{
struct tc_action *a;
- for (a = act; act; a = act) {
- if (a && a->ops && a->ops->cleanup) {
+ for (a = act; a; a = act) {
+ if (a->ops && a->ops->cleanup) {
DPRINTK("tcf_action_destroy destroying %p next %p\n",
- a, a->next ? a->next : NULL);
+ a, a->next);
act = act->next;
if (a->ops->cleanup(a, bind) == ACT_P_DELETED)
module_put(a->ops->owner);
-
- a->ops = NULL;
kfree(a);
} else { /*FIXME: Remove later - catch insertion bugs*/
printk("tcf_action_destroy: BUG? destroying NULL ops\n");
- if (a) {
- act = act->next;
- kfree(a);
- } else {
- printk("tcf_action_destroy: BUG? destroying NULL action!\n");
- break;
- }
+ act = act->next;
+ kfree(a);
}
}
}
@@ -223,7 +216,7 @@
{
int err = -EINVAL;
- if ((a == NULL) || (a->ops == NULL) || (a->ops->dump == NULL))
+ if (a->ops == NULL || a->ops->dump == NULL)
return err;
return a->ops->dump(skb, a, bind, ref);
}
@@ -235,8 +228,7 @@
unsigned char *b = skb->tail;
struct rtattr *r;
- if ((a == NULL) || (a->ops == NULL) || (a->ops->dump == NULL) ||
- (a->ops->kind == NULL))
+ if (a->ops == NULL || a->ops->dump == NULL || a->ops->kind == NULL)
return err;
RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind);
@@ -563,14 +555,9 @@
{
struct tc_action *a;
- for (a = act; act; a = act) {
- if (a) {
- act = act->next;
- a->ops = NULL;
- a->priv = NULL;
- kfree(a);
- } else
- printk("cleanup_a: BUG? empty action\n");
+ for (a = act; a; a = act) {
+ act = a->next;
+ kfree(a);
}
}
@@ -715,7 +702,7 @@
if (tb[i] == NULL)
break;
act = create_a(i+1);
- if (a != NULL && a != act) {
+ if (a != NULL) {
a->next = act;
a = act;
} else
@@ -826,14 +813,9 @@
* stays intact
* */
ret = tcf_add_notify(act, pid, seq, RTM_NEWACTION, n->nlmsg_flags);
- for (a = act; act; a = act) {
- if (a) {
- act = act->next;
- a->ops = NULL;
- a->priv = NULL;
- kfree(a);
- } else
- printk("tcf_action_add: BUG? empty action\n");
+ for (a = act; a; a = act) {
+ act = a->next;
+ kfree(a);
}
done:
return ret;
reply other threads:[~2004-12-30 3:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=41D3786E.3070800@trash.net \
--to=kaber@trash.net \
--cc=hadi@cyberus.ca \
--cc=netdev@oss.sgi.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;
as well as URLs for NNTP newsgroup(s).