* [PATCH] cleanup for net/tipc/name_distr.c::tipc_named_node_up()
@ 2006-03-18 23:45 Jesper Juhl
2006-03-22 9:56 ` Per Liden
0 siblings, 1 reply; 4+ messages in thread
From: Jesper Juhl @ 2006-03-18 23:45 UTC (permalink / raw)
To: linux-kernel
Cc: Per Liden, Jon Maloy, Allan Stephens, tipc-discussion,
Jesper Juhl
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);
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cleanup for net/tipc/name_distr.c::tipc_named_node_up()
2006-03-18 23:45 [PATCH] cleanup for net/tipc/name_distr.c::tipc_named_node_up() Jesper Juhl
@ 2006-03-22 9:56 ` Per Liden
2006-03-26 11:35 ` Jesper Juhl
0 siblings, 1 reply; 4+ messages in thread
From: Per Liden @ 2006-03-22 9:56 UTC (permalink / raw)
To: Jesper Juhl; +Cc: linux-kernel
On Sun, 19 Mar 2006, Jesper Juhl wrote:
> Small cleanup patch for net/tipc/name_distr.c::tipc_named_node_up()
Not sure if you followed the discussion on the tipc mailinglist, so here's
a short summary.
> Patch does the following:
>
> - Change a few pointer assignments from 0 to NULL (makes sparse happy).
Ok.
> - Move a few variable assignment outside the tipc_nametbl_lock lock.
Ok.
> - Make sure to free the allocated buffer before returning so we don't leak.
The additional kfree_skb() looks incorrect. If a buffer if allocated it
will later be released by tipc_link_send().
/Per
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cleanup for net/tipc/name_distr.c::tipc_named_node_up()
2006-03-22 9:56 ` Per Liden
@ 2006-03-26 11:35 ` Jesper Juhl
2006-03-27 12:13 ` Per Liden
0 siblings, 1 reply; 4+ messages in thread
From: Jesper Juhl @ 2006-03-26 11:35 UTC (permalink / raw)
To: Per Liden; +Cc: linux-kernel
On 3/22/06, Per Liden <per.liden@ericsson.com> wrote:
> On Sun, 19 Mar 2006, Jesper Juhl wrote:
>
> > Small cleanup patch for net/tipc/name_distr.c::tipc_named_node_up()
>
> Not sure if you followed the discussion on the tipc mailinglist, so here's
> a short summary.
>
I don't read the tipc mailing list, no.
> > Patch does the following:
> >
> > - Change a few pointer assignments from 0 to NULL (makes sparse happy).
>
> Ok.
>
> > - Move a few variable assignment outside the tipc_nametbl_lock lock.
>
> Ok.
>
Do you want a new patch with just these bits in it or will you take
care of it yourself?
> > - Make sure to free the allocated buffer before returning so we don't leak.
>
> The additional kfree_skb() looks incorrect. If a buffer if allocated it
> will later be released by tipc_link_send().
>
I see. Then that bit is indeed incorrect.
--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cleanup for net/tipc/name_distr.c::tipc_named_node_up()
2006-03-26 11:35 ` Jesper Juhl
@ 2006-03-27 12:13 ` Per Liden
0 siblings, 0 replies; 4+ messages in thread
From: Per Liden @ 2006-03-27 12:13 UTC (permalink / raw)
To: Jesper Juhl; +Cc: linux-kernel
On Sun, 26 Mar 2006, Jesper Juhl wrote:
[...]
> > > Patch does the following:
> > >
> > > - Change a few pointer assignments from 0 to NULL (makes sparse happy).
> >
> > Ok.
> >
> > > - Move a few variable assignment outside the tipc_nametbl_lock lock.
> >
> > Ok.
> >
>
> Do you want a new patch with just these bits in it or will you take
> care of it yourself?
The first one was has already been fixed with another patch that's in
Linus tree right now. The second one is borderline-cosmetic so I'll fix
that the next time I'm making changes in that area.
/Per
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-03-27 12:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-18 23:45 [PATCH] cleanup for net/tipc/name_distr.c::tipc_named_node_up() Jesper Juhl
2006-03-22 9:56 ` Per Liden
2006-03-26 11:35 ` Jesper Juhl
2006-03-27 12:13 ` Per Liden
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox