* [PATCH net-next 0/2] Markup some printk like functions @ 2020-10-28 0:38 Andrew Lunn 2020-10-28 0:38 ` [PATCH net-next 1/2] net: dccp: Add __printf() markup to fix -Wsuggest-attribute=format Andrew Lunn 2020-10-28 0:38 ` [PATCH net-next 2/2] net: tipc: " Andrew Lunn 0 siblings, 2 replies; 4+ messages in thread From: Andrew Lunn @ 2020-10-28 0:38 UTC (permalink / raw) To: Jakub Kicinski; +Cc: netdev, Gerrit Renker, Jon Maloy, Ying Xue, Andrew Lunn W=1 warns of functions which look like printk but don't have attributes so the compile can check that arguments matches the format string. Andrew Lunn (2): net: dccp: Add __printf() markup to fix -Wsuggest-attribute=format net: tipc: Add __printf() markup to fix -Wsuggest-attribute=format net/dccp/ccid.c | 2 +- net/tipc/netlink_compat.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) -- 2.28.0 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next 1/2] net: dccp: Add __printf() markup to fix -Wsuggest-attribute=format 2020-10-28 0:38 [PATCH net-next 0/2] Markup some printk like functions Andrew Lunn @ 2020-10-28 0:38 ` Andrew Lunn 2020-10-28 0:38 ` [PATCH net-next 2/2] net: tipc: " Andrew Lunn 1 sibling, 0 replies; 4+ messages in thread From: Andrew Lunn @ 2020-10-28 0:38 UTC (permalink / raw) To: Jakub Kicinski; +Cc: netdev, Gerrit Renker, Jon Maloy, Ying Xue, Andrew Lunn net/dccp/ccid.c: In function ‘ccid_kmem_cache_create’: net/dccp/ccid.c:85:2: warning: function ‘ccid_kmem_cache_create’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format] 85 | vsnprintf(slab_name_fmt, CCID_SLAB_NAME_LENGTH, fmt, args); Signed-off-by: Andrew Lunn <andrew@lunn.ch> --- net/dccp/ccid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/dccp/ccid.c b/net/dccp/ccid.c index 1e9bb121ba72..6beac5d348e2 100644 --- a/net/dccp/ccid.c +++ b/net/dccp/ccid.c @@ -76,7 +76,7 @@ int ccid_getsockopt_builtin_ccids(struct sock *sk, int len, return err; } -static struct kmem_cache *ccid_kmem_cache_create(int obj_size, char *slab_name_fmt, const char *fmt,...) +static __printf(3, 4) struct kmem_cache *ccid_kmem_cache_create(int obj_size, char *slab_name_fmt, const char *fmt,...) { struct kmem_cache *slab; va_list args; -- 2.28.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net-next 2/2] net: tipc: Add __printf() markup to fix -Wsuggest-attribute=format 2020-10-28 0:38 [PATCH net-next 0/2] Markup some printk like functions Andrew Lunn 2020-10-28 0:38 ` [PATCH net-next 1/2] net: dccp: Add __printf() markup to fix -Wsuggest-attribute=format Andrew Lunn @ 2020-10-28 0:38 ` Andrew Lunn [not found] ` <202010291009.4MeXI3UF-lkp@intel.com> 1 sibling, 1 reply; 4+ messages in thread From: Andrew Lunn @ 2020-10-28 0:38 UTC (permalink / raw) To: Jakub Kicinski; +Cc: netdev, Gerrit Renker, Jon Maloy, Ying Xue, Andrew Lunn net/tipc/netlink_compat.c: In function ‘tipc_tlv_sprintf’: net/tipc/netlink_compat.c:137:2: warning: function ‘tipc_tlv_sprintf’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format] 137 | n = vscnprintf(buf, rem, fmt, args); Signed-off-by: Andrew Lunn <andrew@lunn.ch> --- net/tipc/netlink_compat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c index 1c7aa51cc2a3..17a90a2fe753 100644 --- a/net/tipc/netlink_compat.c +++ b/net/tipc/netlink_compat.c @@ -118,7 +118,8 @@ static void tipc_tlv_init(struct sk_buff *skb, u16 type) skb_put(skb, sizeof(struct tlv_desc)); } -static int tipc_tlv_sprintf(struct sk_buff *skb, const char *fmt, ...) +static __printf(2, 3) int tipc_tlv_sprintf(struct sk_buff *skb, + const char *fmt, ...) { int n; u16 len; -- 2.28.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
[parent not found: <202010291009.4MeXI3UF-lkp@intel.com>]
* Re: [PATCH net-next 2/2] net: tipc: Add __printf() markup to fix -Wsuggest-attribute=format [not found] ` <202010291009.4MeXI3UF-lkp@intel.com> @ 2020-10-29 12:40 ` Andrew Lunn 0 siblings, 0 replies; 4+ messages in thread From: Andrew Lunn @ 2020-10-29 12:40 UTC (permalink / raw) To: kernel test robot; +Cc: kbuild-all, netdev On Thu, Oct 29, 2020 at 10:49:34AM +0800, kernel test robot wrote: > Hi Andrew, > > I love your patch! Perhaps something to improve: > > [auto build test WARNING on net-next/master] > > url: https://github.com/0day-ci/linux/commits/Andrew-Lunn/net-dccp-Add-__printf-markup-to-fix-Wsuggest-attribute-format/20201029-081346 > base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git cd29296fdfca919590e4004a7e4905544f4c4a32 > config: arc-allyesconfig (attached as .config) > compiler: arceb-elf-gcc (GCC) 9.3.0 > reproduce (this is a W=1 build): > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # https://github.com/0day-ci/linux/commit/0be08855cea6e7b987406c1beee6ca1b508f5066 > git remote add linux-review https://github.com/0day-ci/linux > git fetch --no-tags linux-review Andrew-Lunn/net-dccp-Add-__printf-markup-to-fix-Wsuggest-attribute-format/20201029-081346 > git checkout 0be08855cea6e7b987406c1beee6ca1b508f5066 > # save the attached .config to linux build tree > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot <lkp@intel.com> > > All warnings (new ones prefixed by >>): > > net/tipc/netlink_compat.c: In function 'tipc_nl_compat_link_stat_dump': > >> net/tipc/netlink_compat.c:591:39: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'void *' [-Wformat=] > 591 | tipc_tlv_sprintf(msg->rep, "\nLink <%s>\n", > | ~^ > | | > | char * > | %p > 592 | nla_data(link[TIPC_NLA_LINK_NAME])); > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > | | > | void * Yep, which is the point of adding this markup, and why there is a follow up patch fixing this. Please don't let this 0-day report stop the commit being merged. Andrew ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-10-29 12:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-28 0:38 [PATCH net-next 0/2] Markup some printk like functions Andrew Lunn
2020-10-28 0:38 ` [PATCH net-next 1/2] net: dccp: Add __printf() markup to fix -Wsuggest-attribute=format Andrew Lunn
2020-10-28 0:38 ` [PATCH net-next 2/2] net: tipc: " Andrew Lunn
[not found] ` <202010291009.4MeXI3UF-lkp@intel.com>
2020-10-29 12:40 ` Andrew Lunn
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).