mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Dani Liberman <dliberman@habana.ai>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Oded Gabbay <ogabbay@kernel.org>
Subject: [ogabbay:habanalabs-next 1/3] drivers/misc/habanalabs/common/debugfs.c:599:9: warning: function 'hl_engine_data_sprintf' might be a candidate for 'gnu_printf' format attribute
Date: Fri, 15 Jul 2022 00:32:06 +0800	[thread overview]
Message-ID: <202207150057.RUJOxIhW-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux.git habanalabs-next
head:   0339d759da283025aa01ba72cb7e5b6df9978670
commit: b916f64dace37d374de75823a203749caf30fd7c [1/3] habanalabs: removed seq_file parameter from is_idle asic functions
config: i386-randconfig-a001 (https://download.01.org/0day-ci/archive/20220715/202207150057.RUJOxIhW-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
        # https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux.git/commit/?id=b916f64dace37d374de75823a203749caf30fd7c
        git remote add ogabbay https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux.git
        git fetch --no-tags ogabbay habanalabs-next
        git checkout b916f64dace37d374de75823a203749caf30fd7c
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/misc/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/misc/habanalabs/common/debugfs.c: In function 'hl_engine_data_sprintf':
>> drivers/misc/habanalabs/common/debugfs.c:599:9: warning: function 'hl_engine_data_sprintf' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
     599 |         str_size = vsnprintf(NULL, 0, fmt, args) + 1;
         |         ^~~~~~~~
   drivers/misc/habanalabs/common/debugfs.c:604:17: warning: function 'hl_engine_data_sprintf' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
     604 |                 vsnprintf(e->buf + e->actual_size, str_size, fmt, args);
         |                 ^~~~~~~~~


vim +599 drivers/misc/habanalabs/common/debugfs.c

   589	
   590	void hl_engine_data_sprintf(struct engines_data *e, const char *fmt, ...)
   591	{
   592		va_list args;
   593		int str_size;
   594	
   595		va_start(args, fmt);
   596		/* Calculate formatted string length. Assuming each string is null terminated, hence
   597		 * increment result by 1
   598		 */
 > 599		str_size = vsnprintf(NULL, 0, fmt, args) + 1;
   600		va_end(args);
   601	
   602		if ((e->actual_size + str_size) < e->allocated_buf_size) {
   603			va_start(args, fmt);
   604			vsnprintf(e->buf + e->actual_size, str_size, fmt, args);
   605			va_end(args);
   606		}
   607	
   608		/* Need to update the size even when not updating destination buffer to get the exact size
   609		 * of all input strings
   610		 */
   611		e->actual_size += str_size;
   612	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

                 reply	other threads:[~2022-07-14 16:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202207150057.RUJOxIhW-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=dliberman@habana.ai \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ogabbay@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®