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: Wed Nov 08 2023 - 01:13:17 EST
On 06-11-23, 18:41, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: d2f51b3516dade79269ff45eae2a7668ae711b25
> commit: 46f48aca2e5aef3f430e95d1a5fb68227ec8ec85 OPP: Fix missing debugfs supply directory for OPPs
> date: 4 years, 11 months ago
This is a really old commit, are we running the test over it ? Or it is what git
bisect reported ?
> config: x86_64-randconfig-r025-20230725 (https://download.01.org/0day-ci/archive/20231106/202311061847.BOtfUmbQ-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/20231106/202311061847.BOtfUmbQ-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/202311061847.BOtfUmbQ-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);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I tried to reproduce it for ARM and don't see the warning locally. I saw a
similar one earlier (reported by the bot), which is already fixed:
make ARCH=arm64 O=../barm64/ -j8 CROSS_COMPILE=aarch64-linux-gnu- W=1 CONFIG_DEBUG_SECTION_MISMATCH=y
--
viresh