Re: drivers/opp/debugfs.c:48:54: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 8

From: Viresh Kumar
Date: Mon Dec 18 2023 - 01:11:01 EST


On 17-12-23, 06:23, kernel test robot wrote:
> Hi Viresh,
>
> FYI, the error/warning still remains.
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 3b8a9b2e6809d281890dd0a1102dc14d2cd11caf
> commit: 46f48aca2e5aef3f430e95d1a5fb68227ec8ec85 OPP: Fix missing debugfs supply directory for OPPs
> date: 5 years ago
> config: x86_64-randconfig-a006-20230623 (https://download.01.org/0day-ci/archive/20231217/202312170608.s9xI4TQb-lkp@xxxxxxxxx/config)
> compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231217/202312170608.s9xI4TQb-lkp@xxxxxxxxx/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@xxxxxxxxx>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202312170608.s9xI4TQb-lkp@xxxxxxxxx/
>
> All warnings (new ones prefixed by >>):
>
> drivers/opp/debugfs.c: In function 'opp_debug_create_one':
> >> drivers/opp/debugfs.c:48:54: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 8 [-Wformat-truncation=]
> 48 | snprintf(name, sizeof(name), "supply-%d", i);
> | ^~
> In function 'opp_debug_create_supplies',
> inlined from 'opp_debug_create_one' at drivers/opp/debugfs.c:119:7:
> drivers/opp/debugfs.c:48:46: note: directive argument in the range [-2147483644, 2147483646]
> 48 | snprintf(name, sizeof(name), "supply-%d", i);
> | ^~~~~~~~~~~
> drivers/opp/debugfs.c:48:17: note: 'snprintf' output between 9 and 19 bytes into a destination of size 15
> 48 | snprintf(name, sizeof(name), "supply-%d", i);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Can someone check if this happens on mainline too ? I think this is a
False report.

--
viresh