From: Jonathan Cameron <jic23@kernel.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Iain Hunter <drhunter95@gmail.com>,
lothar.felten@gmail.com, iain@hunterembedded.co.uk,
Lars-Peter Clausen <lars@metafoo.de>,
Alexandru Ardelean <alexandru.ardelean@analog.com>,
Gwendal Grignou <gwendal@chromium.org>,
Matt Ranostay <matt.ranostay@konsulko.com>,
Thomas Gleixner <tglx@linutronix.de>,
Zeng Tao <prime.zeng@hisilicon.com>,
linux-iio@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4] workaround regression in ina2xx introduced by cb47755725da("time: Prevent undefined behaviour in timespec64_to_ns()")
Date: Sun, 5 Dec 2021 20:11:03 +0000 [thread overview]
Message-ID: <20211205201103.7e19d647@jic23-huawei> (raw)
In-Reply-To: <CAK8P3a3LPLbJRDEsYgSL9x=rrk1=AmBWxFBNd0H591NKrLnMZA@mail.gmail.com>
On Thu, 30 Sep 2021 13:04:10 +0200
Arnd Bergmann <arnd@arndb.de> wrote:
> On Thu, Sep 30, 2021 at 10:10 AM Iain Hunter <drhunter95@gmail.com> wrote:
> >
> > From: Iain Hunter <iain@hunterembedded.co.uk>
> >
> > That change adds an error check to avoid saturation during multiplication
> > to calculate nano seconds in timespec64_to_ns().
> > In ina2xx_capture_thread() a timespec64 structure is used to calculate
> > the delta time until the next sample time. This delta can be negative if
> > the next sample time was in the past. In the -1 case timespec64_to_ns()
> > now clamps the -1 second value to KTIME_MAX. This essentially puts ina2xx
> > thread to sleep forever.
> > Proposed patch is to:
> > 1 change from timespec64_XXX() to standard raw ktime_XXX() APIs to remove
> > non-standard timespec64 calls.
> > 2 split the functionality in the loop into two parts:
> > - do while loop only does the test to see if the next sample time is in the
> > future or in the past and so will be skipped and the sample time
> > incremented until it is in the future. This test is done with a simple
> > signed comparison as we are only interested in the sign being positive or
> > negative.
> > - after do while loop we know that next is later than now and so delay is
> > positive and ksub_sub() can be used to get the delay which is positive.
> >
> > Signed-off-by: Iain Hunter <iain@hunterembedded.co.uk>
> >
> > Fixes: cb47755725da("time: Prevent undef$
>
> The changelog text could be improved to more closely follow the
> style described in Documentation/process/submitting-patches.rst,
> but the important information is here and the changes look good
> to me.
>
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Hi Iain,
Are you planning to do a v5 with change log tidied up?
In particularly the fixes tag?
Sorry, I should have followed up on this earlier to find out your plans.
Jonathan
prev parent reply other threads:[~2021-12-05 20:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-30 8:10 [PATCH v4] workaround regression in ina2xx introduced by cb47755725da("time: Prevent undefined behaviour in timespec64_to_ns()") Iain Hunter
2021-09-30 11:04 ` Arnd Bergmann
2021-12-05 20:11 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211205201103.7e19d647@jic23-huawei \
--to=jic23@kernel.org \
--cc=alexandru.ardelean@analog.com \
--cc=arnd@arndb.de \
--cc=drhunter95@gmail.com \
--cc=gwendal@chromium.org \
--cc=iain@hunterembedded.co.uk \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lothar.felten@gmail.com \
--cc=matt.ranostay@konsulko.com \
--cc=prime.zeng@hisilicon.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox