Re: [PATCH net-next] enic: use kasprintf instead of snprintf

2017-06-19 Thread David Miller
From: Govindarajulu Varadarajan Date: Sun, 18 Jun 2017 22:05:37 -0700 > With -Wformat-truncation=, gcc throws the following warning. Instead of > using snprintf, use kasprintf and allocate string size as needed. > > drivers/net/ethernet/cisco/enic/enic_main.c: In function ‘enic_open’: > drivers/

Re: [PATCH net-next] enic: use kasprintf instead of snprintf

2017-06-18 Thread Govindarajulu Varadarajan
On Sun, 18 Jun 2017, Joe Perches wrote: Perhaps it'd be better to use a style with a variable length format precision ie: "%.*s-tx-%u", IFNAMSIZ - 4 - , netdev-name, i) This would truncate interface name. Why is this preferred to my patch?

Re: [PATCH net-next] enic: use kasprintf instead of snprintf

2017-06-18 Thread Joe Perches
On Sun, 2017-06-18 at 22:55 -0700, Govindarajulu Varadarajan wrote: > On Sun, 18 Jun 2017, Joe Perches wrote: > > > Perhaps it'd be better to use a style > > with a variable length format precision > > > > ie: > > > > "%.*s-tx-%u", IFNAMSIZ - 4 - , netdev-name, i) > > > > This would trunca

Re: [PATCH net-next] enic: use kasprintf instead of snprintf

2017-06-18 Thread Joe Perches
On Sun, 2017-06-18 at 22:05 -0700, Govindarajulu Varadarajan wrote: > With -Wformat-truncation=, gcc throws the following warning. Instead of > using snprintf, use kasprintf and allocate string size as needed. > > drivers/net/ethernet/cisco/enic/enic_main.c: In function ‘enic_open’: > drivers/net/

[PATCH net-next] enic: use kasprintf instead of snprintf

2017-06-18 Thread Govindarajulu Varadarajan
With -Wformat-truncation=, gcc throws the following warning. Instead of using snprintf, use kasprintf and allocate string size as needed. drivers/net/ethernet/cisco/enic/enic_main.c: In function ‘enic_open’: drivers/net/ethernet/cisco/enic/enic_main.c:1740:15: warning: ‘%u’ directive output may b