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: <CAHp75VcvHQ7m8y5Rm6nVtF-iYop4Gjyzgoo=2jQQkWbc0SQ5Kg@mail.gmail.com>
Date:   Mon, 10 Jul 2023 10:38:02 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Kim Seer Paller <kimseer.paller@...log.com>
Cc:     jic23@...nel.org, lars@...afoo.de, lgirdwood@...il.com,
        broonie@...nel.org, Michael.Hennerich@...log.com, robh@...nel.org,
        krzysztof.kozlowski@...aro.org, conor+dt@...nel.org,
        linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
        devicetree@...r.kernel.org
Subject: Re: [PATCH v9 2/2] iio: adc: max14001: New driver

On Mon, Jul 10, 2023 at 10:36 AM Andy Shevchenko
<andy.shevchenko@...il.com> wrote:
> On Mon, Jul 10, 2023 at 7:27 AM Kim Seer Paller
> <kimseer.paller@...log.com> wrote:

...

> > V8 -> V9: Changed SPI buffer data types to __le16,
>
> Why?
>
> ...
>
> > +       __le16                  spi_tx_buffer __aligned(IIO_DMA_MINALIGN);
> > +       __le16                  spi_rx_buffer;
>
> ...
>
> > +       /*
> > +        * Prepare SPI transmit buffer 16 bit-value to big-endian format and
> > +        * reverses bit order to align with the LSB-first input on SDI port.
>
> reverse
>
> > +        */
> > +       st->spi_tx_buffer = bitrev16(cpu_to_be16(FIELD_PREP(MAX14001_ADDR_MASK,
> > +                                    reg_addr)));
>
> ...
>
> > +       /*
> > +        * Convert received 16-bit value from big-endian to little-endian format
> > +        * and reverses bit order.
>
> reverse
>
> > +        */
> > +       *data = bitrev16(be16_to_cpu(st->spi_rx_buffer));

On top of that, this left unfixed.

...

> > +       /*
> > +        * Prepare SPI transmit buffer 16 bit-value to big-endian format and
> > +        * reverses bit order to align with the LSB-first input on SDI port.
>
> reverse
>
> > +        */
> > +       st->spi_tx_buffer = bitrev16(cpu_to_be16(
> > +                                    FIELD_PREP(MAX14001_ADDR_MASK, reg_addr) |
> > +                                    FIELD_PREP(MAX14001_SET_WRITE_BIT, 1) |
> > +                                    FIELD_PREP(MAX14001_DATA_MASK, data)));
>
> Obviously it's incorrect now even more than before.
> The types are defined as __le, while ops are against __be.


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ