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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f4dfbb6b-b635-e9b3-5e5b-8527cf1e4f60@marcan.st>
Date:   Thu, 6 Jan 2022 22:12:56 +0900
From:   Hector Martin <marcan@...can.st>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
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 v2 09/35] brcmfmac: pcie: Perform firmware selection for
 Apple platforms

On 04/01/2022 23.24, Andy Shevchenko wrote:
> On Tue, Jan 4, 2022 at 9:28 AM Hector Martin <marcan@...can.st> wrote:

>> +               /* Example: apple,shikoku-RASP-m-6.11-X3 */
>> +               len = (strlen(devinfo->settings->board_type) + 1 +
>> +                      strlen(devinfo->otp.module) + 1 +
>> +                      strlen(devinfo->otp.vendor) + 1 +
>> +                      strlen(devinfo->otp.version) + 1 +
>> +                      strlen(devinfo->settings->antenna_sku) + 1);
> 
> NIH devm_kasprrintf() ?

This one builds it incrementally, but you're right, kasprintf is
probably more readable here and fewer lines even though it'll duplicate
all the previous argument references for each pattern. I'll redo it with
devm_kasprintf().

> 
>> +               /* apple,shikoku */
>> +               fwreq->board_types[5] = devinfo->settings->board_type;
>> +
>> +               buf = devm_kzalloc(&devinfo->pdev->dev, len, GFP_KERNEL);
>> +
>> +               strscpy(buf, devinfo->settings->board_type, len);
>> +               strlcat(buf, "-", len);
>> +               strlcat(buf, devinfo->settings->antenna_sku, len);
>> +               /* apple,shikoku-X3 */
>> +               fwreq->board_types[4] = devm_kstrdup(&devinfo->pdev->dev, buf,
>> +                                                    GFP_KERNEL);
>> +
>> +               strscpy(buf, devinfo->settings->board_type, len);
>> +               strlcat(buf, "-", len);
>> +               strlcat(buf, devinfo->otp.module, len);
>> +               /* apple,shikoku-RASP */
>> +               fwreq->board_types[3] = devm_kstrdup(&devinfo->pdev->dev, buf,
>> +                                                    GFP_KERNEL);
>> +
>> +               strlcat(buf, "-", len);
>> +               strlcat(buf, devinfo->otp.vendor, len);
>> +               /* apple,shikoku-RASP-m */
>> +               fwreq->board_types[2] = devm_kstrdup(&devinfo->pdev->dev, buf,
>> +                                                    GFP_KERNEL);
>> +
>> +               strlcat(buf, "-", len);
>> +               strlcat(buf, devinfo->otp.version, len);
>> +               /* apple,shikoku-RASP-m-6.11 */
>> +               fwreq->board_types[1] = devm_kstrdup(&devinfo->pdev->dev, buf,
>> +                                                    GFP_KERNEL);
>> +
>> +               strlcat(buf, "-", len);
>> +               strlcat(buf, devinfo->settings->antenna_sku, len);
>> +               /* apple,shikoku-RASP-m-6.11-X3 */
>> +               fwreq->board_types[0] = buf;
> 


-- 
Hector Martin (marcan@...can.st)
Public Key: https://mrcn.st/pub

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ