From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: kernel/bpf/btf.c:5346:29: warning: function 'btf_seq_show' might be a candidate for 'gnu_printf' format attribute
Date: Sat, 20 Nov 2021 14:02:46 +0800 [thread overview]
Message-ID: <202111201436.qDPqBijy-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 3893 bytes --]
Hi Alan,
FYI, the error/warning still remains.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a90af8f15bdc9449ee2d24e1d73fa3f7e8633f81
commit: 31d0bc81637d8d974a6dad9827b765b4b70c89d7 bpf: Move to generic BTF show support, apply it to seq files/strings
date: 1 year, 2 months ago
config: nds32-buildonly-randconfig-r002-20210927 (attached as .config)
compiler: nds32le-linux-gcc (GCC) 11.2.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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=31d0bc81637d8d974a6dad9827b765b4b70c89d7
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 31d0bc81637d8d974a6dad9827b765b4b70c89d7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=nds32
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 >>):
kernel/bpf/btf.c: In function 'btf_seq_show':
>> kernel/bpf/btf.c:5346:29: warning: function 'btf_seq_show' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
5346 | seq_vprintf((struct seq_file *)show->target, fmt, args);
| ^~~~~~~~
kernel/bpf/btf.c: In function 'btf_snprintf_show':
>> kernel/bpf/btf.c:5383:9: warning: function 'btf_snprintf_show' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
5383 | len = vsnprintf(show->target, ssnprintf->len_left, fmt, args);
| ^~~
vim +5346 kernel/bpf/btf.c
5342
5343 static void btf_seq_show(struct btf_show *show, const char *fmt,
5344 va_list args)
5345 {
> 5346 seq_vprintf((struct seq_file *)show->target, fmt, args);
5347 }
5348
5349 static int btf_type_seq_show_flags(const struct btf *btf, u32 type_id,
5350 void *obj, struct seq_file *m, u64 flags)
5351 {
5352 struct btf_show sseq;
5353
5354 sseq.target = m;
5355 sseq.showfn = btf_seq_show;
5356 sseq.flags = flags;
5357
5358 btf_type_show(btf, type_id, obj, &sseq);
5359
5360 return sseq.state.status;
5361 }
5362
5363 void btf_type_seq_show(const struct btf *btf, u32 type_id, void *obj,
5364 struct seq_file *m)
5365 {
5366 (void) btf_type_seq_show_flags(btf, type_id, obj, m,
5367 BTF_SHOW_NONAME | BTF_SHOW_COMPACT |
5368 BTF_SHOW_ZERO | BTF_SHOW_UNSAFE);
5369 }
5370
5371 struct btf_show_snprintf {
5372 struct btf_show show;
5373 int len_left; /* space left in string */
5374 int len; /* length we would have written */
5375 };
5376
5377 static void btf_snprintf_show(struct btf_show *show, const char *fmt,
5378 va_list args)
5379 {
5380 struct btf_show_snprintf *ssnprintf = (struct btf_show_snprintf *)show;
5381 int len;
5382
> 5383 len = vsnprintf(show->target, ssnprintf->len_left, fmt, args);
5384
5385 if (len < 0) {
5386 ssnprintf->len_left = 0;
5387 ssnprintf->len = len;
5388 } else if (len > ssnprintf->len_left) {
5389 /* no space, drive on to get length we would have written */
5390 ssnprintf->len_left = 0;
5391 ssnprintf->len += len;
5392 } else {
5393 ssnprintf->len_left -= len;
5394 ssnprintf->len += len;
5395 show->target += len;
5396 }
5397 }
5398
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27422 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
Alexei Starovoitov <ast@kernel.org>
Subject: kernel/bpf/btf.c:5346:29: warning: function 'btf_seq_show' might be a candidate for 'gnu_printf' format attribute
Date: Sat, 20 Nov 2021 14:02:46 +0800 [thread overview]
Message-ID: <202111201436.qDPqBijy-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 3793 bytes --]
Hi Alan,
FYI, the error/warning still remains.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a90af8f15bdc9449ee2d24e1d73fa3f7e8633f81
commit: 31d0bc81637d8d974a6dad9827b765b4b70c89d7 bpf: Move to generic BTF show support, apply it to seq files/strings
date: 1 year, 2 months ago
config: nds32-buildonly-randconfig-r002-20210927 (attached as .config)
compiler: nds32le-linux-gcc (GCC) 11.2.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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=31d0bc81637d8d974a6dad9827b765b4b70c89d7
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 31d0bc81637d8d974a6dad9827b765b4b70c89d7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=nds32
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 >>):
kernel/bpf/btf.c: In function 'btf_seq_show':
>> kernel/bpf/btf.c:5346:29: warning: function 'btf_seq_show' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
5346 | seq_vprintf((struct seq_file *)show->target, fmt, args);
| ^~~~~~~~
kernel/bpf/btf.c: In function 'btf_snprintf_show':
>> kernel/bpf/btf.c:5383:9: warning: function 'btf_snprintf_show' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
5383 | len = vsnprintf(show->target, ssnprintf->len_left, fmt, args);
| ^~~
vim +5346 kernel/bpf/btf.c
5342
5343 static void btf_seq_show(struct btf_show *show, const char *fmt,
5344 va_list args)
5345 {
> 5346 seq_vprintf((struct seq_file *)show->target, fmt, args);
5347 }
5348
5349 static int btf_type_seq_show_flags(const struct btf *btf, u32 type_id,
5350 void *obj, struct seq_file *m, u64 flags)
5351 {
5352 struct btf_show sseq;
5353
5354 sseq.target = m;
5355 sseq.showfn = btf_seq_show;
5356 sseq.flags = flags;
5357
5358 btf_type_show(btf, type_id, obj, &sseq);
5359
5360 return sseq.state.status;
5361 }
5362
5363 void btf_type_seq_show(const struct btf *btf, u32 type_id, void *obj,
5364 struct seq_file *m)
5365 {
5366 (void) btf_type_seq_show_flags(btf, type_id, obj, m,
5367 BTF_SHOW_NONAME | BTF_SHOW_COMPACT |
5368 BTF_SHOW_ZERO | BTF_SHOW_UNSAFE);
5369 }
5370
5371 struct btf_show_snprintf {
5372 struct btf_show show;
5373 int len_left; /* space left in string */
5374 int len; /* length we would have written */
5375 };
5376
5377 static void btf_snprintf_show(struct btf_show *show, const char *fmt,
5378 va_list args)
5379 {
5380 struct btf_show_snprintf *ssnprintf = (struct btf_show_snprintf *)show;
5381 int len;
5382
> 5383 len = vsnprintf(show->target, ssnprintf->len_left, fmt, args);
5384
5385 if (len < 0) {
5386 ssnprintf->len_left = 0;
5387 ssnprintf->len = len;
5388 } else if (len > ssnprintf->len_left) {
5389 /* no space, drive on to get length we would have written */
5390 ssnprintf->len_left = 0;
5391 ssnprintf->len += len;
5392 } else {
5393 ssnprintf->len_left -= len;
5394 ssnprintf->len += len;
5395 show->target += len;
5396 }
5397 }
5398
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27422 bytes --]
next reply other threads:[~2021-11-20 6:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-20 6:02 kernel test robot [this message]
2021-11-20 6:02 ` kernel/bpf/btf.c:5346:29: warning: function 'btf_seq_show' might be a candidate for 'gnu_printf' format attribute kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2021-11-12 2:03 kernel test robot
2021-11-12 2:03 ` kernel test robot
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=202111201436.qDPqBijy-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.