[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZeWGpyXXZBeYjnGW@yujie-X299>
Date: Mon, 4 Mar 2024 16:30:31 +0800
From: Yujie Liu <yujie.liu@...el.com>
To: Viresh Kumar <viresh.kumar@...aro.org>
CC: lkp <lkp@...el.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "oe-kbuild-all@...ts.linux.dev"
<oe-kbuild-all@...ts.linux.dev>
Subject: 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
On Mon, Mar 04, 2024 at 12:24:11PM +0530, Viresh Kumar wrote:
> On 21-02-24, 06:01, Liu, Yujie wrote:
> > Hi Viresh,
> >
> > On Wed, 2024-02-14 at 11:28 +0530, Viresh Kumar wrote:
> > > On 14-02-24, 13:43, 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: 7e90b5c295ec1e47c8ad865429f046970c549a66
> > > > commit: 46f48aca2e5aef3f430e95d1a5fb68227ec8ec85 OPP: Fix missing debugfs supply directory for OPPs
> > > > date: 5 years ago
> > > > config: x86_64-buildonly-randconfig-001-20231012 (https://download.01.org/0day-ci/archive/20240214/202402141313.81ltVF5g-lkp@intel.com/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/20240214/202402141313.81ltVF5g-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@...el.com>
> > > > > Closes: https://lore.kernel.org/oe-kbuild-all/202402141313.81ltVF5g-lkp@intel.com/
> > >
> > > I have informed this earlier too, this report is incorrect and applies
> > > to a very old commit.
> >
> > Really sorry for not responding timely to the questions in the
> > following reports:
> >
> > [1] https://lore.kernel.org/all/202311061847.BOtfUmbQ-lkp@intel.com/
> > [2] https://lore.kernel.org/all/202312170608.s9xI4TQb-lkp@intel.com/
> >
> > We see that this still happens on the latest mainline rc regardless of
> > x86_64 or arm64 arch. Please note that this is a "W=1" warning. In our
> > tests, it can be reproduced with gcc-12 and gcc-13, but not with other
> > versions of gcc.
>
> Okay, I have a different version of gcc. Can you see if this change fixes it or
> not ?
This fixes the warning for "supply-%d". Seems there are other remaining
warnings as shown below. Would you like to take a look as well?
CC drivers/opp/debugfs.o
drivers/opp/debugfs.c: In function 'bw_name_read':
drivers/opp/debugfs.c:43:42: error: '%.62s' directive argument is null [-Werror=format-overflow=]
43 | i = scnprintf(buf, sizeof(buf), "%.62s\n", icc_get_name(path));
| ^~~~~
drivers/opp/debugfs.c: In function 'opp_debug_create_one':
drivers/opp/debugfs.c:90:55: error: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 4 [-Werror=format-truncation=]
90 | snprintf(name, sizeof(name), "rate_hz_%d", i);
| ^~
In function 'opp_debug_create_clks',
inlined from 'opp_debug_create_one' at drivers/opp/debugfs.c:162:2:
drivers/opp/debugfs.c:90:46: note: directive argument in the range [-2147483644, 2147483646]
90 | snprintf(name, sizeof(name), "rate_hz_%d", i);
| ^~~~~~~~~~~~
drivers/opp/debugfs.c:90:17: note: 'snprintf' output between 10 and 20 bytes into a destination of size 12
90 | snprintf(name, sizeof(name), "rate_hz_%d", i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Best Regards,
Yujie
>
> diff --git a/drivers/opp/debugfs.c b/drivers/opp/debugfs.c
> index ec030b19164a..986c08e18d05 100644
> --- a/drivers/opp/debugfs.c
> +++ b/drivers/opp/debugfs.c
> @@ -100,7 +100,7 @@ static void opp_debug_create_supplies(struct dev_pm_opp *opp,
> int i;
>
> for (i = 0; i < opp_table->regulator_count; i++) {
> - char name[15];
> + char name[19];
>
> snprintf(name, sizeof(name), "supply-%d", i);
>
> --
> viresh
Powered by blists - more mailing lists