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: <CAHp75Vf4kXi9TAvEW=JvA9SLRYuTtwwBvzH4vGoP2CRrk9vX8g@mail.gmail.com>
Date:   Wed, 21 Jun 2023 11:21:17 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     "Paller, Kim Seer" <KimSeer.Paller@...log.com>
Cc:     "jic23@...nel.org" <jic23@...nel.org>,
        "lars@...afoo.de" <lars@...afoo.de>,
        "lgirdwood@...il.com" <lgirdwood@...il.com>,
        "broonie@...nel.org" <broonie@...nel.org>,
        "Hennerich, Michael" <Michael.Hennerich@...log.com>,
        "robh@...nel.org" <robh@...nel.org>,
        "krzysztof.kozlowski@...aro.org" <krzysztof.kozlowski@...aro.org>,
        "conor+dt@...nel.org" <conor+dt@...nel.org>,
        "linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>
Subject: Re: [PATCH v7 2/2] iio: adc: max14001: New driver

On Wed, Jun 21, 2023 at 3:38 AM Paller, Kim Seer
<KimSeer.Paller@...log.com> wrote:
> > From: Andy Shevchenko <andy.shevchenko@...il.com>
> > Sent: Tuesday, June 20, 2023 11:15 PM
> > On Tue, Jun 20, 2023 at 4:27 PM Kim Seer Paller
> > <kimseer.paller@...log.com> wrote:

...

> > > +       /*
> > > +        * Align received data from the receive buffer, reversing and reordering
> > > +        * it to match the expected MSB-first format.
> > > +        */
> > > +       *data = (__force u16)(be16_to_cpu(bitrev16(st->spi_rx_buffer))) &
> > > +                                                       MAX14001_DATA_MASK;
> >
> > Using __force in the C files is somehow stinky.

...

> > > +       /*
> > > +        * Convert transmit buffer to big-endian format and reverse transmit
> > > +        * buffer to align with the LSB-first input on SDI port.
> > > +        */
> > > +       st->spi_tx_buffer = (__force u16)(cpu_to_be16(bitrev16(
> >
> > You have a different type of spi_tx_buffer than u16, don't you?
>
> I have the same type of spi_tx_buffer as u16.

And you should have __be16.

> Other than using force cast, is there any way to resolve the endian warning? I have
> actually swapped the order of bitrev16() and cpu_to_be16/be16_to_cpu() functions.
> I have tested and they also work fine.

You really have to get it correct on both LE and BE architectures.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ