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, 5 Jul 2020 15:05:49 +0300
Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote:

> 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.
> 
Good point. Dropped for now. Will revisit.

Thanks,

Jonathan




[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