netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: David Miller <davem@davemloft.net>,
	per.linden@ericsson.com, jon.maloy@ericsson.com,
	allan.stephens@windriver.com
Cc: tipc-discussion@lists.sourceforge.net, netdev@vger.kernel.org
Subject: [PATCH] tipc: fix non-const printf format arguments
Date: Tue, 17 Mar 2009 11:28:32 -0700	[thread overview]
Message-ID: <20090317112832.66832ce4@nehalam> (raw)

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>

---
 net/tipc/bcast.c |    4 ++--
 net/tipc/bcast.h |    2 +-
 net/tipc/dbg.c   |    2 +-
 net/tipc/node.c  |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

--- a/net/tipc/bcast.c	2009-03-17 11:17:23.196668013 -0700
+++ b/net/tipc/bcast.c	2009-03-17 11:24:54.277355254 -0700
@@ -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);
--- a/net/tipc/bcast.h	2009-03-17 11:19:59.985355078 -0700
+++ b/net/tipc/bcast.h	2009-03-17 11:20:07.009542787 -0700
@@ -70,7 +70,7 @@ struct port_list {
 
 struct tipc_node;
 
-extern char tipc_bclink_name[];
+extern const char tipc_bclink_name[];
 
 
 /**
--- a/net/tipc/dbg.c	2009-03-17 11:22:58.825479925 -0700
+++ b/net/tipc/dbg.c	2009-03-17 11:23:52.503463479 -0700
@@ -258,7 +258,7 @@ void tipc_printf(struct print_buf *pb, c
 	}
 
 	if (pb->echo)
-		printk(print_string);
+		printk("%s", print_string);
 
 	spin_unlock_bh(&print_lock);
 }
--- a/net/tipc/node.c	2009-03-17 11:22:24.129480376 -0700
+++ b/net/tipc/node.c	2009-03-17 11:25:13.389229628 -0700
@@ -703,7 +703,7 @@ struct sk_buff *tipc_node_get_links(cons
 
 	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 */

             reply	other threads:[~2009-03-17 18:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-17 18:28 Stephen Hemminger [this message]
2009-03-19  2:11 ` [PATCH] tipc: fix non-const printf format arguments David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090317112832.66832ce4@nehalam \
    --to=shemminger@vyatta.com \
    --cc=allan.stephens@windriver.com \
    --cc=davem@davemloft.net \
    --cc=jon.maloy@ericsson.com \
    --cc=netdev@vger.kernel.org \
    --cc=per.linden@ericsson.com \
    --cc=tipc-discussion@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).