Hi Alan,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on bpf-next/master]
url:
https://github.com/0day-ci/linux/commits/Alan-Maguire/bpf-add-helpers-to-...
base:
https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: sparc-randconfig-p002-20200917 (attached as .config)
compiler: sparc-linux-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
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sparc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
> kernel/bpf/btf.c:5310:6: warning: no previous prototype for
'btf_type_show' [-Wmissing-prototypes]
5310 | void btf_type_show(const
struct btf *btf, u32 type_id, void *obj,
| ^~~~~~~~~~~~~
kernel/bpf/btf.c: In function 'btf_seq_show':
> kernel/bpf/btf.c:5327:22: warning: function
'btf_seq_show' might be a candidate for 'gnu_printf' format attribute
[-Wsuggest-attribute=format]
5327 | seq_vprintf((struct seq_file
*)show->target, fmt, args);
| ^~~~~~~~
kernel/bpf/btf.c: In function 'btf_snprintf_show':
> kernel/bpf/btf.c:5357:2: warning: function
'btf_snprintf_show' might be a candidate for 'gnu_printf' format attribute
[-Wsuggest-attribute=format]
5357 | len = vsnprintf(show->target,
ssnprintf->len_left, fmt, args);
| ^~~
#
https://github.com/0day-ci/linux/commit/a85186d405b24251bfd7179ae1949f345...
git remote add linux-review
https://github.com/0day-ci/linux
git fetch --no-tags linux-review
Alan-Maguire/bpf-add-helpers-to-support-BTF-based-kernel-data-display/20200918-213932
git checkout a85186d405b24251bfd7179ae1949f3458e9702d
vim +/btf_type_show +5310 kernel/bpf/btf.c
5309
5310 void btf_type_show(const struct btf *btf, u32 type_id, void
*obj,
5311 struct btf_show *show)
5312 {
5313 const struct btf_type *t = btf_type_by_id(btf, type_id);
5314
5315 show->btf = btf;
5316 memset(&show->state, 0, sizeof(show->state));
5317 memset(&show->obj, 0, sizeof(show->obj));
5318
5319 btf_type_ops(t)->show(btf, t, type_id, obj, 0, show);
5320 }
5321
5322 static void btf_seq_show(struct btf_show *show, const char *fmt, ...)
5323 {
5324 va_list args;
5325
5326 va_start(args, fmt);
5327 seq_vprintf((struct seq_file *)show->target, fmt, args);
5328 va_end(args);
5329 }
5330
5331 void btf_type_seq_show(const struct btf *btf, u32 type_id, void *obj,
5332 struct seq_file *m)
5333 {
5334 struct btf_show sseq;
5335
5336 sseq.target = m;
5337 sseq.showfn = btf_seq_show;
5338 sseq.flags = BTF_SHOW_NONAME | BTF_SHOW_COMPACT | BTF_SHOW_ZERO |
5339 BTF_SHOW_UNSAFE;
5340
5341 btf_type_show(btf, type_id, obj, &sseq);
5342 }
5343
5344 struct btf_show_snprintf {
5345 struct btf_show show;
5346 int len_left; /* space left in string */
5347 int len; /* length we would have written */
5348 };
5349
5350 static void btf_snprintf_show(struct btf_show *show, const char *fmt, ...)
5351 {
5352 struct btf_show_snprintf *ssnprintf = (struct btf_show_snprintf *)show;
5353 va_list args;
5354 int len;
5355
5356 va_start(args, fmt);
5357 len = vsnprintf(show->target, ssnprintf->len_left, fmt,
args);
5358 va_end(args);
5359
5360 if (len < 0) {
5361 ssnprintf->len_left = 0;
5362 ssnprintf->len = len;
5363 } else if (len > ssnprintf->len_left) {
5364 /* no space, drive on to get length we would have written */
5365 ssnprintf->len_left = 0;
5366 ssnprintf->len += len;
5367 } else {
5368 ssnprintf->len_left -= len;
5369 ssnprintf->len += len;
5370 show->target += len;
5371 }
5372 }
5373
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org