lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202111121037.KBoq23aL-lkp@intel.com>
Date:   Fri, 12 Nov 2021 10:03:47 +0800
From:   kernel test robot <lkp@...el.com>
To:     Alan Maguire <alan.maguire@...cle.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Alexei Starovoitov <ast@...nel.org>
Subject: kernel/bpf/btf.c:5346:29: warning: function 'btf_seq_show' might be
 a candidate for 'gnu_printf' format attribute

Hi Alan,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   5833291ab6de9c3e2374336b51c814e515e8f3a5
commit: 31d0bc81637d8d974a6dad9827b765b4b70c89d7 bpf: Move to generic BTF show support, apply it to seq files/strings
date:   1 year, 1 month 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@...el.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

Download attachment ".config.gz" of type "application/gzip" (27422 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ