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: <CAFBinCBLjE051KeFzFZzjc=0ZuMHOQwRfWasxWRUOSwQO3jqYg@mail.gmail.com>
Date:   Thu, 27 Jul 2023 21:14:51 +0200
From:   Martin Blumenstingl <martin.blumenstingl@...glemail.com>
To:     Alexey Romanov <avromanov@...rdevices.ru>
Cc:     narmstrong@...libre.com, neil.armstrong@...aro.org,
        olivia@...enic.com, herbert@...dor.apana.org.au,
        robh+dt@...nel.org, krzysztof.kozlowski+dt@...aro.org,
        conor+dt@...nel.org, khilman@...libre.com, jbrunet@...libre.com,
        f.fainelli@...il.com, hkallweit1@...il.com,
        linux-arm-kernel@...ts.infradead.org,
        linux-amlogic@...ts.infradead.org, linux-kernel@...r.kernel.org,
        devicetree@...r.kernel.org, linux-crypto@...r.kernel.org,
        kernel@...rdevices.ru
Subject: Re: [PATCH v1 1/3] drivers: rng: add check status bit feature

Hello Alexey,

On Tue, Jul 25, 2023 at 4:13 PM Alexey Romanov <avromanov@...rdevices.ru> wrote:
[...]
>  static int meson_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
>  {
>         struct meson_rng_data *data =
>                         container_of(rng, struct meson_rng_data, rng);
> +       const struct meson_rng_priv *priv = data->priv;
> +
> +       if (priv->check_status_bit) {
> +               void __iomem *cfg_addr = data->base + priv->cfg_offset;
> +               int err;
Have you considered just creating two separate functions:
- meson_rng_read
- meson_s4_rng_read

Then you don't need all of these if/else.
You can even skip the whole offset description in your new struct
meson_rng_priv.
All of this can make the code easier to understand.

> +               writel_relaxed(readl_relaxed(cfg_addr) | BIT(SEED_READY_STS_BIT), cfg_addr);
Why not just #define SEED_READY_STS as BIT(...) right away?


Best regards,
Martin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ