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]
Message-ID: <CAM+2EuJ3n4RVHVh9ZH-HkkjUm+zLLt=g34H5aOxPiDW673NOrw@mail.gmail.com>
Date:   Thu, 28 Apr 2022 02:31:47 +0530
From:   Jagath Jog J <jagathjog1996@...il.com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Dan Robertson <dan@...obertson.com>,
        Jonathan Cameron <jic23@...nel.org>,
        linux-iio <linux-iio@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 5/9] iio: accel: bma400: Add separate channel for step counter

Hi Andy,

On Wed, Apr 27, 2022 at 6:04 PM Andy Shevchenko
<andy.shevchenko@...il.com> wrote:
>
> On Wed, Apr 20, 2022 at 11:11 PM Jagath Jog J <jagathjog1996@...il.com> wrote:
> >
> > Added channel for step counter which can be enable or disable
> > through the sysfs interface.
>
> ...
>
> > +static int bma400_enable_steps(struct bma400_data *data, int val)
> > +{
> > +       int ret;
> > +
> > +       if (data->steps_enabled == val)
> > +               return 0;
> > +
> > +       ret = regmap_update_bits(data->regmap, BMA400_INT_CONFIG1_REG,
> > +                                BMA400_STEP_INT_MSK,
> > +                                FIELD_PREP(BMA400_STEP_INT_MSK, !!val));
>
> > +       data->steps_enabled = val;
>
> This will update the value even if we got an error and actual device
> state is unknown here. Does this make sense?

I will correct this in the next series.

>
> > +       return ret;
> > +}
>
> ...
>
> I perhaps missed why kmalloc() is needed now. Any pointers to the discussion?

Here step is a 24-bit value and since this is a sysfs channel read (slow path),
kmalloc() is used to make the buffer DMA safe to read the multibyte value
using regmap_bulk_read().

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

Thank you,
Jagath

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ