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, 19 Jul 2021 15:13:49 +0200
From:   Andrea Merello <andrea.merello@...il.com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Rob Herring <robh+dt@...nel.org>,
        Matt Ranostay <matt.ranostay@...sulko.com>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        linux-iio <linux-iio@...r.kernel.org>,
        Andrea Merello <andrea.merello@....it>
Subject: Re: [PATCH 2/4] iio: imu: add Bosch Sensortec BNO055 core driver

Il giorno lun 19 lug 2021 alle ore 13:48 Andy Shevchenko
<andy.shevchenko@...il.com> ha scritto:
>
> On Mon, Jul 19, 2021 at 11:02:07AM +0200, Andrea Merello wrote:
> > Il giorno gio 15 lug 2021 alle ore 18:50 Andy Shevchenko
> > <andy.shevchenko@...il.com> ha scritto:
> >
> > >
> > > > +/* must be called in configuration mode */
> > > > +int bno055_calibration_load(struct bno055_priv *priv, const struct firmware *fw)
> > > > +{
> > > > +       int i;
> > > > +       unsigned int tmp;
> > > > +       u8 cal[BNO055_CALDATA_LEN];
> > > > +       int read, tot_read = 0;
> > > > +       int ret = 0;
> > > > +       char *buf = kmalloc(fw->size + 1, GFP_KERNEL);
> > > > +
> > > > +       if (!buf)
> > > > +               return -ENOMEM;
> > > > +
> > > > +       memcpy(buf, fw->data, fw->size);
> > >
> > > kmemdup() ?
> > >
> >
> > As a second thought: no, the whole point of reallocating and copying
> > here, is that we want to allocate an extra byte; kmemdup() will
> > allocate and copy only the very same amount of memory
>
> kmemdup_nul() then.

That's one seems suitable. Thank you.

>
> --
> With Best Regards,
> Andy Shevchenko
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ