public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>
Subject: drivers/thermal/thermal_debugfs.c:252:59: warning: '%d' directive output may be truncated writing between 1 and 5 bytes into a region of size between 3 and 8
Date: Fri, 3 Jan 2025 14:25:54 +0800	[thread overview]
Message-ID: <202501031443.lYgZAIKE-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   0bc21e701a6ffacfdde7f04f87d664d82e8a13bf
commit: 755113d7678681a137c330f7997ceb680adb644e thermal/debugfs: Add thermal cooling device debugfs information
date:   12 months ago
config: csky-randconfig-051-20240716 (https://download.01.org/0day-ci/archive/20250103/202501031443.lYgZAIKE-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 12.4.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250103/202501031443.lYgZAIKE-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501031443.lYgZAIKE-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/thermal/thermal_debugfs.c:103:6: warning: no previous prototype for 'thermal_debug_init' [-Wmissing-prototypes]
     103 | void thermal_debug_init(void)
         |      ^~~~~~~~~~~~~~~~~~
   drivers/thermal/thermal_debugfs.c:329:6: warning: no previous prototype for 'thermal_debug_cdev_state_update' [-Wmissing-prototypes]
     329 | void thermal_debug_cdev_state_update(const struct thermal_cooling_device *cdev,
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/thermal/thermal_debugfs.c:389:6: warning: no previous prototype for 'thermal_debug_cdev_add' [-Wmissing-prototypes]
     389 | void thermal_debug_cdev_add(struct thermal_cooling_device *cdev)
         |      ^~~~~~~~~~~~~~~~~~~~~~
   drivers/thermal/thermal_debugfs.c:431:6: warning: no previous prototype for 'thermal_debug_cdev_remove' [-Wmissing-prototypes]
     431 | void thermal_debug_cdev_remove(struct thermal_cooling_device *cdev)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/thermal/thermal_debugfs.c: In function 'cdev_tt_seq_show':
>> drivers/thermal/thermal_debugfs.c:252:59: warning: '%d' directive output may be truncated writing between 1 and 5 bytes into a region of size between 3 and 8 [-Wformat-truncation=]
     252 |                 snprintf(buffer, ARRAY_SIZE(buffer), "%d->%d",
         |                                                           ^~
   drivers/thermal/thermal_debugfs.c:252:54: note: directive argument in the range [0, 65535]
     252 |                 snprintf(buffer, ARRAY_SIZE(buffer), "%d->%d",
         |                                                      ^~~~~~~~
   drivers/thermal/thermal_debugfs.c:252:17: note: 'snprintf' output between 5 and 14 bytes into a destination of size 11
     252 |                 snprintf(buffer, ARRAY_SIZE(buffer), "%d->%d",
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     253 |                          entry->id >> 16, entry->id & 0xFFFF);
         |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +252 drivers/thermal/thermal_debugfs.c

   233	
   234	static int cdev_tt_seq_show(struct seq_file *s, void *v)
   235	{
   236		struct thermal_debugfs *thermal_dbg = s->private;
   237		struct cdev_debugfs *cdev_dbg = &thermal_dbg->cdev_dbg;
   238		struct list_head *transitions = cdev_dbg->transitions;
   239		struct cdev_record *entry;
   240		int i = *(loff_t *)v;
   241	
   242		if (!i)
   243			seq_puts(s, "Transition\tOccurences\n");
   244	
   245		list_for_each_entry(entry, &transitions[i], node) {
   246			/*
   247			 * Assuming maximum cdev states is 1024, the longer
   248			 * string for a transition would be "1024->1024\0"
   249			 */
   250			char buffer[11];
   251	
 > 252			snprintf(buffer, ARRAY_SIZE(buffer), "%d->%d",
   253				 entry->id >> 16, entry->id & 0xFFFF);
   254	
   255			seq_printf(s, "%-10s\t%-10llu\n", buffer, entry->count);
   256		}
   257	
   258		return 0;
   259	}
   260	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

             reply	other threads:[~2025-01-03  6:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-03  6:25 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-01-14 17:06 drivers/thermal/thermal_debugfs.c:252:59: warning: '%d' directive output may be truncated writing between 1 and 5 bytes into a region of size between 3 and 8 kernel test robot
2025-05-10  0:32 kernel test robot
2025-06-10 12:47 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=202501031443.lYgZAIKE-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=rjw@rjwysocki.net \
    /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