tipc: fix non-const printf format arguments
authorStephen Hemminger <shemminger@vyatta.com>
Thu, 19 Mar 2009 02:11:29 +0000 (19:11 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 19 Mar 2009 02:11:29 +0000 (19:11 -0700)
Fix warnings from current gcc about using non-const strings as printf
args in TIPC. Compile tested only (not a TIPC user).

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/bcast.c
net/tipc/bcast.h
net/tipc/dbg.c
net/tipc/node.c

index 3ddaff42d1bbbe8292d3be98d7b8dd8e0bcbfceb..a3bfd40649125721809b51ca419770d6321dd8ad 100644 (file)
@@ -119,7 +119,7 @@ static struct bclink *bclink = NULL;
 static struct link *bcl = NULL;
 static DEFINE_SPINLOCK(bc_lock);
 
-char tipc_bclink_name[] = "multicast-link";
+const char tipc_bclink_name[] = "multicast-link";
 
 
 static u32 buf_seqno(struct sk_buff *buf)
@@ -800,7 +800,7 @@ int tipc_bclink_init(void)
        tipc_link_set_queue_limits(bcl, BCLINK_WIN_DEFAULT);
        bcl->b_ptr = &bcbearer->bearer;
        bcl->state = WORKING_WORKING;
-       sprintf(bcl->name, tipc_bclink_name);
+       strlcpy(bcl->name, tipc_bclink_name, TIPC_MAX_LINK_NAME);
 
        if (BCLINK_LOG_BUF_SIZE) {
                char *pb = kmalloc(BCLINK_LOG_BUF_SIZE, GFP_ATOMIC);
index 2f2d731bc1c29bbb79cdc6ad1ed666784ad2a4fc..4c1771e95c99ed2ad0b43a07f2690fa69d043af0 100644 (file)
@@ -70,7 +70,7 @@ struct port_list {
 
 struct tipc_node;
 
-extern char tipc_bclink_name[];
+extern const char tipc_bclink_name[];
 
 
 /**
index 29ecae8516683df21403c78a934b44da7a714c88..1885a7edb0c8014831e3e6f2a9f9a91ba326674d 100644 (file)
@@ -258,7 +258,7 @@ void tipc_printf(struct print_buf *pb, const char *fmt, ...)
        }
 
        if (pb->echo)
-               printk(print_string);
+               printk("%s", print_string);
 
        spin_unlock_bh(&print_lock);
 }
index 20d98c56e152685a5ab84e584e9a31a33cb1bfec..2c24e7d6d9506a38a0072c2517da793ed57b81ba 100644 (file)
@@ -703,7 +703,7 @@ struct sk_buff *tipc_node_get_links(const void *req_tlv_area, int req_tlv_space)
 
        link_info.dest = htonl(tipc_own_addr & 0xfffff00);
        link_info.up = htonl(1);
-       sprintf(link_info.str, tipc_bclink_name);
+       strlcpy(link_info.str, tipc_bclink_name, TIPC_MAX_LINK_NAME);
        tipc_cfg_append_tlv(buf, TIPC_TLV_LINK_INFO, &link_info, sizeof(link_info));
 
        /* Add TLVs for any other links in scope */