Skip to contentSkip to conversation

warnings from recent format patch

DISCUSSION Stephen Hemminger 2 participants 2 messages Nov 3, 2008

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Even if you can't run it, please compile and run sparse on your code.

CC [M] net/sunrpc/xprtsock.o
net/sunrpc/xprtsock.c: In function ‘xs_format_ipv4_peer_addresses’:
net/sunrpc/xprtsock.c:287: warning: too many arguments for format

static void xs_format_ipv4_peer_addresses(struct rpc_xprt *xprt,
const char *protocol, const char *netid)

{
	struct sockaddr_in *addr = xs_addr_in(xprt);
	char *buf;

	buf = kzalloc(20, GFP_KERNEL);
	if (buf) {
		snprintf(buf, 20, "pI4", &addr->sin_addr.s_addr);
                                   ^
                                   missing %
maintainer
#1 lore raw

From: Stephen Hemminger <[email protected]>
Date: Sun, 2 Nov 2008 16:33:11 -0800

Quoted 6 lines

Even if you can't run it, please compile and run sparse on your code.

CC [M] net/sunrpc/xprtsock.o
net/sunrpc/xprtsock.c: In function ‘xs_format_ipv4_peer_addresses’:
net/sunrpc/xprtsock.c:287: warning: too many arguments for format

Thanks so much for the patch Stephen, that's so much better than what most people do, which is just whine.

commit e0db4a786bbd73145b4feb45c75d49b6e60fe72c

Author: David S. Miller <[email protected]>
Date:   Sun Nov 2 23:57:06 2008 -0800

sunrpc: Fix build warning due to typo in %pI4 format changes.

Noticed by Stephen Hemminger.

net/sunrpc/xprtsock.c +1 -1
index c14d3fd..5cbb404 100644
@@ -284,7 +284,7 @@ static void xs_format_ipv4_peer_addresses(struct rpc_xprt *xprt,
 
 	buf = kzalloc(20, GFP_KERNEL);
 	if (buf) {
-		snprintf(buf, 20, "pI4", &addr->sin_addr.s_addr);
+		snprintf(buf, 20, "%pI4", &addr->sin_addr.s_addr);
 	}
 	xprt->address_strings[RPC_DISPLAY_ADDR] = buf;