Re: [bug report] fsinfo: Allow fsinfo() to look up a mount object by ID

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

 



<dan.carpenter@xxxxxxxxxx> wrote:

>    604          ret = kstrtoul(name, 0, &mnt_id);

Hmmm...  I'm a bit surprised there isn't a warning generated: kstrtoul() takes
a pointer to an unsigned long, not a long.  mnt_id should be an unsigned
long.  I'll fix that.

>    607          if (mnt_id > INT_MAX)
>                     ^^^^^^^^^^^^^^^^
> This can be negative.  Why do we need to check this at all?  Can we just
> delete this check?

As we get a long, it can go out of range for the mount parameter we're
checking - which is an int.  I feel it's better to restrict it so that we
don't get a false match due to implicit masking.

I wonder if struct mount::mnt_id should actually be unsigned int rather than
int - there doesn't seem any reason it should go negative.

David




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

  Powered by Linux