lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240305060949.pjzb54zkcelt5xgz@vireshk-i7>
Date: Tue, 5 Mar 2024 11:39:49 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Dhruva Gole <d-gole@...com>
Cc: Viresh Kumar <vireshk@...nel.org>, Nishanth Menon <nm@...com>,
	Stephen Boyd <sboyd@...nel.org>, linux-pm@...r.kernel.org,
	Vincent Guittot <vincent.guittot@...aro.org>,
	"Rafael J. Wysocki" <rafael@...nel.org>,
	kernel test robot <lkp@...el.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2 1/2] OPP: debugfs: Fix warning with W=1 builds

On 04-03-24, 17:08, Dhruva Gole wrote:
> Hi,
> 
> On 04/03/24 16:52, Viresh Kumar wrote:
> > We currently get the following warning:
> > 
> > debugfs.c:105:54: error: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 8 [-Werror=format-truncation=]
> >                   snprintf(name, sizeof(name), "supply-%d", i);
> >                                                        ^~
> > debugfs.c:105:46: note: directive argument in the range [-2147483644, 2147483646]
> >                   snprintf(name, sizeof(name), "supply-%d", i);
> >                                                ^~~~~~~~~~~
> > debugfs.c:105:17: note: 'snprintf' output between 9 and 19 bytes into a destination of size 15
> >                   snprintf(name, sizeof(name), "supply-%d", i);
> > 
> > Fix this and another potential issues it by allocating larger arrays.
> 
> Just to keep in mind while applying maybe: s/another/other
> 
> > Use the exact string format to allocate the arrays without getting into
> > these issues again.
> > Reported-by: kernel test robot <lkp@...el.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202402141313.81ltVF5g-lkp@intel.com/
> > Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
> > ---
> > V2: Use string name while allocating memory for the array to fix potential
> > issues later on.
> > 
> >   drivers/opp/debugfs.c | 8 ++++----
> >   1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/opp/debugfs.c b/drivers/opp/debugfs.c
> > index ec030b19164a..27c3748347af 100644
> > --- a/drivers/opp/debugfs.c
> > +++ b/drivers/opp/debugfs.c
> > @@ -56,11 +56,11 @@ static void opp_debug_create_bw(struct dev_pm_opp *opp,
> >   				struct dentry *pdentry)
> >   {
> >   	struct dentry *d;
> > -	char name[20];
> > +	char name[] = "icc-path-XXXXXXXXXX"; /* Integers can take 10 chars max */

Integers can take 11 chars max, I forgot the negative symbol. Added
space for another byte and pushed the changes.

> Feels like a better solution to me than the previous revision, thanks!
> 
> 
> Reviewed-by: Dhruva Gole <d-gole@...com>

Thanks.

-- 
viresh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ