lkml.org 
[lkml]   [2022]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] libfs: fix negative value support in simple_attr_write()
On Mon, Sep 19, 2022 at 02:24:13PM -0700, Andrew Morton wrote:
> On Sun, 18 Sep 2022 13:50:36 +0000 Eliav Farber <farbere@amazon.com> wrote:
>
> > After commit 488dac0c9237 ("libfs: fix error cast of negative value in
> > simple_attr_write()"), a user trying set a negative value will get a
> > '-EINVAL' error, because simple_attr_write() was modified to use
> > kstrtoull() which can handle only unsigned values, instead of
> > simple_strtoll().
> >
> > This breaks all the places using DEFINE_DEBUGFS_ATTRIBUTE() with format
> > of a signed integer.
> >
> > The u64 value which attr->set() receives is not an issue for negative
> > numbers.
> > The %lld and %llu in any case are for 64-bit value. Representing it as
> > unsigned simplifies the generic code, but it doesn't mean we can't keep
> > their signed value if we know that.
> >
> > This change basically reverts the mentioned commit, but uses kstrtoll()
> > instead of simple_strtoll() which is obsolete.
> >
>
> https://lkml.kernel.org/r/20220919172418.45257-1-akinobu.mita@gmail.com
> addresses the same thing.
>
> Should the final version of this fix be backported into -stable trees?

But it questioning the formatting string as a parameter. Why do we need that
in the first place then?

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2022-09-21 16:40    [W:0.086 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site