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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vfj-uqzmY24ByXLnhgyhEuaGpZckdczwUf=2OXL3aBuog@mail.gmail.com>
Date:   Thu, 20 Jan 2022 12:52:16 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Hector Martin <marcan@...can.st>
Cc:     Kalle Valo <kvalo@...eaurora.org>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Len Brown <lenb@...nel.org>,
        Arend van Spriel <aspriel@...il.com>,
        Franky Lin <franky.lin@...adcom.com>,
        Hante Meuleman <hante.meuleman@...adcom.com>,
        Chi-hsien Lin <chi-hsien.lin@...ineon.com>,
        Wright Feng <wright.feng@...ineon.com>,
        Dmitry Osipenko <digetx@...il.com>,
        Sven Peter <sven@...npeter.dev>,
        Alyssa Rosenzweig <alyssa@...enzweig.io>,
        Mark Kettenis <kettenis@...nbsd.org>,
        Rafał Miłecki <zajec5@...il.com>,
        Pieter-Paul Giesberts <pieter-paul.giesberts@...adcom.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Hans de Goede <hdegoede@...hat.com>,
        "John W. Linville" <linville@...driver.com>,
        "brian m. carlson" <sandals@...stytoothpaste.net>,
        "open list:TI WILINK WIRELES..." <linux-wireless@...r.kernel.org>,
        netdev <netdev@...r.kernel.org>,
        devicetree <devicetree@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        "open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER" 
        <brcm80211-dev-list.pdl@...adcom.com>,
        SHA-cyfmac-dev-list@...ineon.com
Subject: Re: [PATCH v3 7/9] brcmfmac: of: Use devm_kstrdup for board_type &
 check for errors

On Mon, Jan 17, 2022 at 4:31 PM Hector Martin <marcan@...can.st> wrote:
>
> This was missing a NULL check, and we can collapse the strlen/alloc/copy
> into a devm_kstrdup().

Nice patch. After dropping the message,
Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>

>                 /* get rid of '/' in the compatible string to be able to find the FW */
>                 len = strlen(tmp) + 1;
> -               board_type = devm_kzalloc(dev, len, GFP_KERNEL);
> -               strscpy(board_type, tmp, len);
> +               board_type = devm_kstrdup(dev, tmp, GFP_KERNEL);
> +               if (!board_type) {
> +                       brcmf_err("out of memory allocating board_type\n");
> +                       of_node_put(root);
> +                       return;
> +               }

>                 for (i = 0; i < board_type[i]; i++) {
>                         if (board_type[i] == '/')
>                                 board_type[i] = '-';

Next step is to replace this with NIH strreplace()

And
  of_property_read_string_index(root, "compatible", 0, &tmp);
with
  of_property_read_string(root, "compatible", &tmp);

And might add an error check, but I believe if there is no compatible
property present, this can't be called.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ