Re: [PATCH 11/32] iio:light:st_uvis25 Fix timestamp alignment and prevent data leak.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jun 7, 2020 at 6:57 PM Jonathan Cameron <jic23@xxxxxxxxxx> wrote:

...

> +       /* Ensure timestamp is naturally aligned */
> +       struct {
> +               u8 chan;
> +               s64 ts __aligned(8);
> +       } scan;
>  };

...

> -       err = regmap_read(hw->regmap, ST_UVIS25_REG_OUT_ADDR, (int *)buffer);
> +       err = regmap_read(hw->regmap, ST_UVIS25_REG_OUT_ADDR,
> +                         (unsigned int *)&hw->scan.chan);

Despite knowing that this is okay, from a language perspective this
casting is not good. Potential mine for all kinds of static analyzers.

I think it should use a temporary unsigned int (or what regmap API
wants) variable.

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux