]> err.no Git - linux-2.6/blobdiff - net/tipc/link.c
[NETFILTER]: nf_conntrack: add helper function for expectation initialization
[linux-2.6] / net / tipc / link.c
index c6831c75cfa4dd9ec9c03fb3da7cb451928f7a0c..1bb983c8130b32be1b70e776b04ee573f6530c42 100644 (file)
@@ -132,7 +132,7 @@ static void link_print(struct link *l_ptr, struct print_buf *buf,
  * allow the output from multiple links to be intermixed.  For this reason
  * routines of the form "dbg_link_XXX()" have been created that will capture
  * debug info into a link's personal print buffer, which can then be dumped
- * into the TIPC system log (LOG) upon request.
+ * into the TIPC system log (TIPC_LOG) upon request.
  *
  * To enable per-link debugging, use LINK_LOG_BUF_SIZE to specify the size
  * of the print buffer used by each link.  If LINK_LOG_BUF_SIZE is set to 0,
@@ -141,7 +141,7 @@ static void link_print(struct link *l_ptr, struct print_buf *buf,
  * when there is only a single link in the system being debugged.
  *
  * Notes:
- * - When enabled, LINK_LOG_BUF_SIZE should be set to at least 1000 (bytes)
+ * - When enabled, LINK_LOG_BUF_SIZE should be set to at least TIPC_PB_MIN_SIZE
  * - "l_ptr" must be valid when using dbg_link_XXX() macros  
  */
 
@@ -159,13 +159,13 @@ static void link_print(struct link *l_ptr, struct print_buf *buf,
 
 static void dbg_print_link(struct link *l_ptr, const char *str)
 {
-       if (DBG_OUTPUT)
+       if (DBG_OUTPUT != TIPC_NULL)
                link_print(l_ptr, DBG_OUTPUT, str);
 }
 
 static void dbg_print_buf_chain(struct sk_buff *root_buf)
 {
-       if (DBG_OUTPUT) {
+       if (DBG_OUTPUT != TIPC_NULL) {
                struct sk_buff *buf = root_buf;
 
                while (buf) {
@@ -417,12 +417,11 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
        struct tipc_msg *msg;
        char *if_name;
 
-       l_ptr = (struct link *)kmalloc(sizeof(*l_ptr), GFP_ATOMIC);
+       l_ptr = kzalloc(sizeof(*l_ptr), GFP_ATOMIC);
        if (!l_ptr) {
                warn("Link creation failed, no memory\n");
                return NULL;
        }
-       memset(l_ptr, 0, sizeof(*l_ptr));
 
        l_ptr->addr = peer;
        if_name = strchr(b_ptr->publ.name, ':') + 1;
@@ -998,6 +997,8 @@ static int link_bundle_buf(struct link *l_ptr,
                return 0;
        if (skb_tailroom(bundler) < (pad + size))
                return 0;
+       if (link_max_pkt(l_ptr) < (to_pos + size))
+               return 0;
 
        skb_put(bundler, pad + size);
        memcpy(bundler->data + to_pos, buf->data, size);
@@ -1665,8 +1666,9 @@ static void link_retransmit_failure(struct link *l_ptr, struct sk_buff *buf)
                char addr_string[16];
 
                tipc_printf(TIPC_OUTPUT, "Msg seq number: %u,  ", msg_seqno(msg));
-               tipc_printf(TIPC_OUTPUT, "Outstanding acks: %u\n", (u32)TIPC_SKB_CB(buf)->handle);
-               
+               tipc_printf(TIPC_OUTPUT, "Outstanding acks: %lu\n",
+                                    (unsigned long) TIPC_SKB_CB(buf)->handle);
+
                n_ptr = l_ptr->owner->next;
                tipc_node_lock(n_ptr);