[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM4PR11MB730285570907E1A77D5115C6E44C9@DM4PR11MB7302.namprd11.prod.outlook.com>
Date: Tue, 20 Sep 2022 12:48:03 +0000
From: "Shevchenko, Andriy" <andriy.shevchenko@...el.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
Eliav Farber <farbere@...zon.com>
CC: "viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>,
"yangyicong@...ilicon.com" <yangyicong@...ilicon.com>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"hhhawa@...zon.com" <hhhawa@...zon.com>,
"jonnyc@...zon.com" <jonnyc@...zon.com>,
Akinobu Mita <akinobu.mita@...il.com>
Subject: VS: [PATCH] libfs: fix negative value support in simple_attr_write()
________________________________________
Lähettäjä: Andrew Morton <akpm@...ux-foundation.org>
Lähetetty: tiistai 20. syyskuuta 2022 0.24
Vastaanottaja: Eliav Farber
Kopio: viro@...iv.linux.org.uk; yangyicong@...ilicon.com; linux-fsdevel@...r.kernel.org; linux-kernel@...r.kernel.org; Shevchenko, Andriy; hhhawa@...zon.com; jonnyc@...zon.com; Akinobu Mita
Aihe: Re: [PATCH] libfs: fix negative value support in simple_attr_write()
On Sun, 18 Sep 2022 13:50:36 +0000 Eliav Farber <farbere@...zon.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?
Oh, this rises the question, why the heck we even have the format parameter to those macros? Seems to me like a (hackish) workaround against the known issue which was introduced by the previously mentioned change.
Powered by blists - more mailing lists