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: <aa108d68-cf89-9909-2574-5c748a218a77@redhat.com>
Date:   Sat, 16 Sep 2023 14:57:30 +0200
From:   Hans de Goede <hdegoede@...hat.com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Steve Wahl <steve.wahl@....com>,
        Justin Ernst <justin.ernst@....com>,
        Kyle Meyer <kyle.meyer@....com>,
        Dimitri Sivanich <dimitri.sivanich@....com>,
        Russ Anderson <russ.anderson@....com>,
        Darren Hart <dvhart@...radead.org>,
        Andy Shevchenko <andy@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        "H . Peter Anvin" <hpa@...or.com>, x86@...nel.org,
        linux-kernel@...r.kernel.org, Justin Stitt <justinstitt@...gle.com>
Subject: Re: [PATCH v2] x86/platform/uv: Rework NMI "action" modparam handling

Hi,

On 9/14/23 10:42, Andy Shevchenko wrote:
> On Wed, Sep 13, 2023 at 9:01 PM Hans de Goede <hdegoede@...hat.com> wrote:
>>
>> Rework NMI "action" modparam handling:
>>
>> 1. Replace the uv_nmi_action string with an enum; and
>> 2. Use sysfs_match_string() for string parsing in param_set_action()
> 
> ...
> 
> Don't you need to include string.h?

Yes (pre-existing problem really, but still). Will fix for v3.

> 
> ...
> 
>> +enum action_t {
>> +       nmi_act_kdump,
>> +       nmi_act_dump,
>> +       nmi_act_ips,
>> +       nmi_act_kdb,
>> +       nmi_act_kgdb,
>> +       nmi_act_health,
>>  };
> 
>> +
>> +static_assert(ARRAY_SIZE(actions) == ARRAY_SIZE(actions_desc));
> 
> I believe with enum in place you don't need this, just add a terminator to it
> 
> enum action_t {
>    ...
>    nmi_act_max
> };
> 
> and use as an array size both arrays.
> 
> ...
> 
>> -       int i;
>> -       int n = ARRAY_SIZE(valid_acts);
> 
>> +       int i, n = ARRAY_SIZE(actions);
> 
> Since you are changing them, why not make them unsigned?

i is used to store the result of sysfs_match_string() which
returns a negative errno.

> 
> ...
> 
>> -       pr_err("UV: Invalid NMI action:%s, valid actions are:\n", arg);
>> +       pr_err("UV: Invalid NMI action:%s, valid actions are:\n", val);
> 
> As mentioned previously the val may or may not have a new line in it.
> I dunno about comma removal, but a new line presence can be easily checked.
> 
> Either way it's not so critical, hence removing comma. or replacing it
> by '-' (dash) may be enough.

I'll fix this for v3 by not printing the wrong val at all as suggested
by Steve Wahl.

Regards,

Hans

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ