Linux Power Management development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Len Brown <lenb@kernel.org>
Cc: linux-pm@vger.kernel.org, Len Brown <len.brown@intel.com>
Subject: Re: [PATCH 04/18] x86_energy_perf_policy: Cleanup: Harden with strtol()
Date: Sun, 25 Oct 2026 23:33:34 +0200	[thread overview]
Message-ID: <at51rncC9c0LTqp7@ashevche-desk.local> (raw)
In-Reply-To: <CAJvTdKnYCAAKquPZ_aa16htpQoS3BR-MAbZ8c+YXj23eZ4QLMw@mail.gmail.com>

On Sat, Oct 24, 2026 at 01:53:00PM -0400, Len Brown wrote:
> On Wed, Oct 21, 2026 at 11:56 AM Andy Shevchenko
> <andriy.shevchenko@intel.com> wrote:

...

> > > void cmdline(int argc, char **argv)
> >
> > >               case 'u':
> > >                       update_hwp_use_pkg++;
> > > -                     if (atoi(optarg) == 0)
> > > +                     char *endp;
> > > +                     long val;
> >
> > Doesn't this require {} scope in the switch-case?
> 
> added. thx.
> 
> (C99 lets you get away with this, but braces clarify scope.)

Right, as well as with the definitions in the middle of the code. Maybe define
the variables on top? (I admit I haven't checked the style for this in use in
this tool, but if it's already uses the C99 approach, I'm fine. Otherwise I'm
all for consistent style.)

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-10-25 21:33 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 16:43 [PATCH 0/18] x86_energy_perf_policy cleanups Len Brown
2026-10-19 16:43 ` [PATCH 01/18] x86_energy_perf_policy: Create msr_path helper Len Brown
2026-10-19 16:43   ` [PATCH 02/18] x86_energy_perf_policy: Enhance MSR probe Len Brown
2026-10-20  9:44     ` Andy Shevchenko
2026-10-19 16:43   ` [PATCH 03/18] x86_energy_perf_policy: Prevent unlikely buffer overflow Len Brown
2026-10-20  9:46     ` Andy Shevchenko
2026-10-19 16:43   ` [PATCH 04/18] x86_energy_perf_policy: Cleanup: Harden with strtol() Len Brown
2026-10-21 15:56     ` Andy Shevchenko
2026-10-24 17:53       ` Len Brown
2026-10-25 21:33         ` Andy Shevchenko [this message]
2026-10-19 16:43   ` [PATCH 05/18] x86_energy_perf_policy: Cleanup: Use snprintf() for platform-profile Len Brown
2026-10-21 15:57     ` Andy Shevchenko
2026-10-19 16:43   ` [PATCH 06/18] x86_energy_perf_policy: Fix optarg keyword matching Len Brown
2026-10-21 15:58     ` Andy Shevchenko
2026-10-19 16:43   ` [PATCH 07/18] x86_energy_perf_policy: Cleanup: Fix potential ratio overflow Len Brown
2026-10-21 16:06     ` Andy Shevchenko
2026-10-19 16:43   ` [PATCH 08/18] x86_energy_perf_policy: Bound package iteration Len Brown
2026-10-21 16:08     ` Andy Shevchenko
2026-10-19 16:43   ` [PATCH 09/18] x86_energy_perf_policy: Cleanup: Define HWP window max Len Brown
2026-10-21 16:10     ` Andy Shevchenko
2026-10-19 16:43   ` [PATCH 10/18] x86_energy_perf_policy: Cleanup: Define BCLK_MHZ Len Brown
2026-10-21 16:16     ` Andy Shevchenko
2026-10-24 18:22       ` Len Brown
2026-10-25 21:30         ` Andy Shevchenko
2026-10-19 16:43   ` [PATCH 11/18] x86_energy_perf_policy: Cleanup: Check fseek() in VM path Len Brown
2026-10-21 16:19     ` Andy Shevchenko
2026-10-19 16:43   ` [PATCH 12/18] x86_energy_perf_policy: Document MSRHEADER Len Brown
2026-10-21 16:31     ` Andy Shevchenko
2026-10-19 16:43   ` [PATCH 13/18] x86_energy_perf_policy: Cleanup: Drop unused signal.h Len Brown
2026-10-21 16:38     ` Andy Shevchenko
2026-10-19 16:43   ` [PATCH 14/18] x86_energy_perf_policy: Cleanup: Constify profile name arg Len Brown
2026-10-21 16:39     ` Andy Shevchenko
2026-10-19 16:43   ` [PATCH 15/18] x86_energy_perf_policy: Cleanup: Constify HWP strings Len Brown
2026-10-21 16:39     ` Andy Shevchenko
2026-10-19 16:43   ` [PATCH 16/18] x86_energy_perf_policy: Fix use-after-free in err_on_hypervisor() Len Brown
2026-10-21 16:42     ` Andy Shevchenko
2026-10-19 16:43   ` [PATCH 17/18] x86_energy_perf_policy: Fix write_sysfs() return type Len Brown
2026-10-21 16:45     ` Andy Shevchenko
2026-10-24 17:37       ` Len Brown
2026-10-19 16:43   ` [PATCH 18/18] MAINTAINERS: Add x86_energy_perf_policy Len Brown
2026-10-21 16:46     ` Andy Shevchenko
2026-10-19 18:33   ` [PATCH 01/18] x86_energy_perf_policy: Create msr_path helper Andy Shevchenko
2026-10-20  9:35     ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=at51rncC9c0LTqp7@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=len.brown@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-pm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox