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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGRGNgWH7PW4fgMOYtEVohrPq0MVusKFOpF8GXCbMDA5D7BScA@mail.gmail.com>
Date: Tue, 23 Apr 2024 16:28:17 +1000
From: Julian Calaby <julian.calaby@...il.com>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Yangtao Li <tiny.windzz@...il.com>, 
	Chen-Yu Tsai <wens@...e.org>, Jernej Skrabec <jernej.skrabec@...il.com>, 
	Samuel Holland <samuel@...lland.org>, linux-pm@...r.kernel.org, 
	Vincent Guittot <vincent.guittot@...aro.org>, kernel test robot <lkp@...el.com>, 
	linux-arm-kernel@...ts.infradead.org, linux-sunxi@...ts.linux.dev, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cpufreq: sun50i: Fix build warning around snprint()

Hi Viresh,

On Tue, Apr 23, 2024 at 4:12 PM Viresh Kumar <viresh.kumar@...aro.org> wrote:
>
> On 23-04-24, 11:38, Julian Calaby wrote:
> > On Mon, Apr 22, 2024 at 1:31 PM Viresh Kumar <viresh.kumar@...aro.org> wrote:
> > > diff --git a/drivers/cpufreq/sun50i-cpufreq-nvmem.c b/drivers/cpufreq/sun50i-cpufreq-nvmem.c
> > > index 30e5c337611c..cd50cea16a87 100644
> > > --- a/drivers/cpufreq/sun50i-cpufreq-nvmem.c
> > > +++ b/drivers/cpufreq/sun50i-cpufreq-nvmem.c
> > > @@ -208,7 +206,7 @@ static int sun50i_cpufreq_get_efuse(void)
> > >  static int sun50i_cpufreq_nvmem_probe(struct platform_device *pdev)
> > >  {
> > >         int *opp_tokens;
> > > -       char name[MAX_NAME_LEN];
> > > +       char name[] = "speedXXXXXXXXXXX"; /* Integers can take 11 chars max */
> >
> > Would it make sense to just set a static length for the string here,
> > say 17-20 characters and add a comment explaining the number, say: /*
> > "speed" + 11 chars for the int */
> >
> > The string constant, while it'll probably be optimised away, seems
> > weird and wasteful.
>
> The counting goes wrong (I have done it in the past) sometimes and so
> I like to explicitly reserve space like this, it also makes it look
> cleaner, i.e. how the eventual string will be named.

I completely agree - ultimately it's whatever works and either way
works equally well.

Thanks,

-- 
Julian Calaby

Email: julian.calaby@...il.com
Profile: http://www.google.com/profiles/julian.calaby/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ