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]
Date:   Mon, 8 Aug 2022 10:53:16 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Angel Iglesias <ang.iglesiasg@...il.com>
Cc:     linux-iio <linux-iio@...r.kernel.org>,
        Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Paul Cercueil <paul@...pouillou.net>,
        Ulf Hansson <ulf.hansson@...aro.org>,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 2/5] iio: pressure: bmp280: Fix alignment for DMA safety

On Sun, Aug 7, 2022 at 1:56 PM Angel Iglesias <ang.iglesiasg@...il.com> wrote:
>
> Adds DMA-safe buffers to driver data struct to store raw data from sensors
>
> The multiple buffers used thorough the driver share the same memory
> allocated as part of the device data instance. The union containing
> the buffers is aligned to allow safe usage with DMA operations, such
> as regmap bulk read calls.

...

>  #include <linux/completion.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/random.h>

+ Blank line.

> +#include <asm/unaligned.h>

...

> +       union {
> +               /* sensor data buffer */
> +               u8 data[3];
> +               /* calibration data buffers */
> +               __le16 bmp280_cal[BMP280_CONTIGUOUS_CALIB_REGS / 2];
> +               __be16 bmp180_cal[BMP180_REG_CALIB_COUNT / 2];
> +       } buf __aligned(IIO_DMA_MINALIGN);

Hmm... And which field in the struct defines which of the buffers is being used?
Also, do you need a non-anonymous union?

>  };

...

> +       /* parse temperature calibration data */

Be consistent! Check all your patches for the consistency (comments,
other code style, etc).

...

> +       calib->H5 = sign_extend32(((get_unaligned_le16(data->buf.data) >> 4) & 0xfff), 11);

(It's not directly related to this change, but good to ask)
Are you going to change all those masks to use GENMASK()?

...

> +       struct bmp180_calib *calib = &data->calib.bmp180;
>         int ret;
>         int i;
> -       struct bmp180_calib *calib = &data->calib.bmp180;

Exactly my point given the previous patch, now you have a ping-pong
style of changes: the introduced line in the series is being touched
again in the very same series without any need.

...

>         u8 oss = data->oversampling_press;
> +       int ret;

Ditto.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ