Messages in this thread Patch in this message | | | From | Jesper Juhl <> | Subject | [PATCH] cleanup for net/tipc/name_distr.c::tipc_named_node_up() | Date | Sun, 19 Mar 2006 00:45:23 +0100 |
| |
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); }
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |