[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20211205201103.7e19d647@jic23-huawei>
Date: Sun, 5 Dec 2021 20:11:03 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Arnd Bergmann <arnd@...db.de>
Cc: Iain Hunter <drhunter95@...il.com>, lothar.felten@...il.com,
iain@...terembedded.co.uk, Lars-Peter Clausen <lars@...afoo.de>,
Alexandru Ardelean <alexandru.ardelean@...log.com>,
Gwendal Grignou <gwendal@...omium.org>,
Matt Ranostay <matt.ranostay@...sulko.com>,
Thomas Gleixner <tglx@...utronix.de>,
Zeng Tao <prime.zeng@...ilicon.com>, linux-iio@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4] workaround regression in ina2xx introduced by
cb47755725da("time: Prevent undefined behaviour in timespec64_to_ns()")
On Thu, 30 Sep 2021 13:04:10 +0200
Arnd Bergmann <arnd@...db.de> wrote:
> On Thu, Sep 30, 2021 at 10:10 AM Iain Hunter <drhunter95@...il.com> wrote:
> >
> > From: Iain Hunter <iain@...terembedded.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@...terembedded.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@...db.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
Powered by blists - more mailing lists