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: <CAHp75VfXwDAwwmzbcx4g1uEuzhzMJ31K1bsTrwYFZGbz3tLMBw@mail.gmail.com>
Date:   Tue, 5 Jul 2022 21:04:59 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Stefan Binding <sbinding@...nsource.cirrus.com>
Cc:     "Rafael J . Wysocki" <rafael@...nel.org>,
        Len Brown <lenb@...nel.org>, Mark Brown <broonie@...nel.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        ALSA Development Mailing List <alsa-devel@...a-project.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        patches@...nsource.cirrus.com
Subject: Re: [PATCH v5 1/2] ACPI: utils: Add api to read _SUB from ACPI

On Thu, Jun 30, 2022 at 5:17 PM Stefan Binding
<sbinding@...nsource.cirrus.com> wrote:
>
> Add a wrapper function to read the _SUB string from ACPI.

...

> +       if (obj->type == ACPI_TYPE_STRING) {
> +               if (strlen(obj->string.pointer) < ACPI_MAX_SUB_BUF_SIZE &&
> +                   strlen(obj->string.pointer) > 0) {
> +                       sub = kstrdup(obj->string.pointer, GFP_KERNEL);
> +                       if (!sub)
> +                               sub = ERR_PTR(-ENOMEM);
> +               } else {
> +                       acpi_handle_err(handle, "ACPI _SUB Length %zu is Invalid\n",
> +                                       strlen(obj->string.pointer));

Three times to evaluate strlen()... Can we do better, please?

> +                       sub = ERR_PTR(-EINVAL);
> +               }
> +       } else {
> +               acpi_handle_warn(handle, "Warning ACPI _SUB did not return a string\n");
> +               sub = ERR_PTR(-EINVAL);
> +       }

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ