cleanup for net/tipc/name_distr.c::tipc_named_node_up()
Subsystems (2)
PATCH 1/1 cleanup for net/tipc/name_distr.c::tipc_named_node_up()
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.
---
net/tipc/name_distr.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
net/tipc/name_distr.c +5 -4
@@ -168,17 +168,17 @@ void tipc_named_withdraw(struct publicatvoid 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); }
Quoted 1 line · Jesper Juhl
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.
Quoted 3 lines
Patch does the following:
- Change a few pointer assignments from 0 to NULL (makes sparse happy).
Ok.
Quoted 1 line
- Move a few variable assignment outside the
tipc_nametbl_locklock.
Ok.
Quoted 1 line
- 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
Quoted 7 lines · Per Liden
Quoted 1 line · Jesper Juhl
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.
Quoted 10 lines
Quoted 3 lines
Patch does the following:
- Change a few pointer assignments from 0 to NULL (makes sparse happy).
Ok.
Quoted 1 line
- Move a few variable assignment outside the
tipc_nametbl_locklock.Ok.
Do you want a new patch with just these bits in it or will you take care of it yourself?
Quoted 5 lines
Quoted 1 line
- 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 bytipc_link_send().
I see. Then that bit is indeed incorrect.
--
Jesper Juhl <[email protected]>
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
On Sun, 26 Mar 2006, Jesper Juhl wrote:
[...]
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Patch does the following:
- Change a few pointer assignments from 0 to NULL (makes sparse happy).
Ok.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
- Move a few variable assignment outside the
tipc_nametbl_locklock.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