From: Jesper Juhl <jesper.juhl@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Per Liden <per.liden@ericsson.com>,
Jon Maloy <jon.maloy@ericsson.com>,
Allan Stephens <allan.stephens@windriver.com>,
tipc-discussion@lists.sourceforge.net,
Jesper Juhl <jesper.juhl@gmail.com>
Subject: [PATCH] cleanup for net/tipc/name_distr.c::tipc_named_node_up()
Date: Sun, 19 Mar 2006 00:45:23 +0100 [thread overview]
Message-ID: <200603190045.24176.jesper.juhl@gmail.com> (raw)
Small cleanup patch for net/tipc/name_distr.c::tipc_named_node_up()
Patch does the following:
- Change a few pointer assignments from 0 to NULL (makes sparse happy).
- Move a few variable assignment outside the tipc_nametbl_lock lock.
- Make sure to free the allocated buffer before returning so we don't leak.
Note: patch is compile tested only and I'm not familiar with this code, so
please check my changes carefully.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---
net/tipc/name_distr.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
--- linux-2.6.16-rc6-orig/net/tipc/name_distr.c 2006-03-12 14:19:18.000000000 +0100
+++ linux-2.6.16-rc6/net/tipc/name_distr.c 2006-03-19 00:36:41.000000000 +0100
@@ -168,17 +168,17 @@ void tipc_named_withdraw(struct publicat
void tipc_named_node_up(unsigned long node)
{
struct publication *publ;
- struct distr_item *item = 0;
- struct sk_buff *buf = 0;
+ struct distr_item *item = NULL;
+ struct sk_buff *buf = NULL;
u32 left = 0;
u32 rest;
u32 max_item_buf;
assert(in_own_cluster(node));
- read_lock_bh(&tipc_nametbl_lock);
max_item_buf = TIPC_MAX_USER_MSG_SIZE / ITEM_SIZE;
max_item_buf *= ITEM_SIZE;
rest = publ_cnt * ITEM_SIZE;
+ read_lock_bh(&tipc_nametbl_lock);
list_for_each_entry(publ, &publ_root, local_list) {
if (!buf) {
@@ -200,10 +200,11 @@ void tipc_named_node_up(unsigned long no
"<%u.%u.%u>\n", tipc_zone(node),
tipc_cluster(node), tipc_node(node));
tipc_link_send(buf, node, node);
- buf = 0;
+ buf = NULL;
}
}
exit:
+ kfree_skb(buf);
read_unlock_bh(&tipc_nametbl_lock);
}
next reply other threads:[~2006-03-18 23:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-18 23:45 Jesper Juhl [this message]
2006-03-22 9:56 ` [PATCH] cleanup for net/tipc/name_distr.c::tipc_named_node_up() Per Liden
2006-03-26 11:35 ` Jesper Juhl
2006-03-27 12:13 ` Per Liden
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=200603190045.24176.jesper.juhl@gmail.com \
--to=jesper.juhl@gmail.com \
--cc=allan.stephens@windriver.com \
--cc=jon.maloy@ericsson.com \
--cc=linux-kernel@vger.kernel.org \
--cc=per.liden@ericsson.com \
--cc=tipc-discussion@lists.sourceforge.net \
/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