Re: [PATCH] libfs: fix negative value support in simple_attr_write()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/20/2022 12:24 AM, Andrew Morton wrote:
On Sun, 18 Sep 2022 13:50:36 +0000 Eliav Farber <farbere@xxxxxxxxxx> 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@xxxxxxxxx
addresses the same thing.

Should the final version of this fix be backported into -stable trees?


I think that my patch can be dropped in favor of Akinobu's patch.

--
Regards, Eliav




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux