drivers/watchdog/w83627hf_wdt.c:477:76: warning: 'snprintf' output may be truncated before the last format character

kernel test robot <[email protected]> Tue, 28 Jul 2026 03:18:53 +0200
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://github.com/intel-lab-lkp/linux/commits/Paul-Louvel/watchdog-w83627hf_wdt-Replace-magic-numbers-with-descriptive-macros/20260727-030530
head:   755bcbc553aec8647f0f337daf2a12011b6e76b2
commit: 31600ea3f7702c3248b36b22a275225428a0092c watchdog: w83627hf_wdt: Convert to platform driver model
date:   30 hours ago
config: x86_64-randconfig-2005-20250721 (https://download.01.org/0day-ci/archive/20260728/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260728/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

   drivers/watchdog/w83627hf_wdt.c: In function 'wdt_probe':
>> drivers/watchdog/w83627hf_wdt.c:477:76: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=]
     477 |         snprintf(wdt_info.identity, sizeof(wdt_info.identity), "%s Watchdog",
         |                                                                            ^
   drivers/watchdog/w83627hf_wdt.c:477:9: note: 'snprintf' output between 10 and 33 bytes into a destination of size 32
     477 |         snprintf(wdt_info.identity, sizeof(wdt_info.identity), "%s Watchdog",
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     478 |                  id->name);
         |                  ~~~~~~~~~


vim +/snprintf +477 drivers/watchdog/w83627hf_wdt.c

   467	
   468	static int wdt_probe(struct platform_device *pdev)
   469	{
   470		const struct platform_device_id *id = platform_get_device_id(pdev);
   471		enum chips chip = id->driver_data;
   472		struct device *dev = &pdev->dev;
   473		int ret;
   474	
   475		dev_info(dev, "WDT driver initialising\n");
   476	
 > 477		snprintf(wdt_info.identity, sizeof(wdt_info.identity), "%s Watchdog",
   478			 id->name);
   479	
   480		watchdog_init_timeout(&wdt_dev, timeout, NULL);
   481		watchdog_set_nowayout(&wdt_dev, nowayout);
   482		watchdog_stop_on_reboot(&wdt_dev);
   483	
   484		ret = w83627hf_init(&wdt_dev, chip);
   485		if (ret)
   486			return dev_err_probe(dev, ret, "failed to initialize watchdog\n");
   487	
   488		ret = devm_watchdog_register_device(&pdev->dev, &wdt_dev);
   489		if (ret)
   490			return ret;
   491	
   492		dev_info(dev, "initialized. timeout=%d sec (nowayout=%d)\n",
   493			 wdt_dev.timeout, nowayout);
   494	
   495		return ret;
   496	}
   497	

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