Re: [SECOND RESEND] vfs: Return -ENXIO for negative SEEK_HOLE / SEEK_DATA offsets

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

 



On Tue, Sep 26, 2017 at 11:48 AM, Andreas Gruenbacher
<agruenba@xxxxxxxxxx> wrote:
>
> When whence == SEEK_HOLE and offset < 0, generic_file_llseek_size will
> return the
> file size instead of -EINVAL. That's at least very weird, and should be fixed.

Ahh, yes. I looked at the first part of your patch (SEEK_DATA) and
went "that's nonsensical", because that one just uses offset, and will
then error out in vfs_setpos().

But you're right, SEEK_HOLE will then use "eof" for offset, and an
originally negative offset will just be ignored.

Ho humm. My gut feeling is that "maxsize" and "eof" should have been
unsigned types to begin with, since signed values don't make sense for
those. That would have taken care of the issue too.

But ok, I'll apply the patch.  Changing the signature of the function
looks like much too much effort for something like this.

                  Linus



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]