[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1203958429.19319.273.camel@localhost>
Date: Mon, 25 Feb 2008 08:53:49 -0800
From: Joe Perches <joe@...ches.com>
To: Johannes Berg <johannes@...solutions.net>
Cc: David Miller <davem@...emloft.net>, kaber@...sh.net,
harvey.harrison@...il.com, netdev@...r.kernel.org
Subject: Re: New sparse warning in net/mac80211/debugfs_sta.c
On Mon, 2008-02-25 at 10:53 +0100, Johannes Berg wrote:
> Maybe we should just add a new printf modifier like %M for MAC
> addresses? Then we could use sprintf, snprintf, printk and whatever we
> please without any of the macro stuff...
Could gcc validate the printf %M arguments?
Another possibility without changing printf argument validation
is to use a MAC_FMT macro in place of "%s"
#ifdef CONFIG_INLINE_MAC
#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
#define DECLARE_MAC_BUF(var)
#define print_mac(buf, addr) (addr)[0], (addr)[1], (addr)[2], (addr)[3], (addr)[4], (addr)[5]
#else
#define MAC_FMT "%s"
#define DECLARE_MAC_BUF(var) char var[18];
extern char *print_mac(char *buf, const unsigned char *addr);
#endif
use:
DECLARE_MAC_BUF(mac);
printk(KERN_INFO "Mac address is: " MAC_FMT "\n", print_mac(mac, addr));
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists