fs/affs: bugfix: Write files greater than page size on OFS
authorFabian Frederick <fabf@skynet.be>
Mon, 24 Apr 2017 20:13:10 +0000 (22:13 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 27 Apr 2017 03:54:06 +0000 (23:54 -0400)
Previous AFFS patch fixed OFS write operations but unveiled
another bug: files greater than 4KB are being created with a wrong
size resulting in errors like the following:

dd if=/dev/zero of=file bs=4097 count=1
cp file /mnt/affs/
cp: error writing '/mnt/affs/file': Bad address

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/affs/file.c

index e5c5de6b85e5b9c8d4de9a5d3921cac9e7795bf3..196ee7f6fdc40e45235178b55abbc54461fbbb49 100644 (file)
@@ -679,7 +679,7 @@ static int affs_write_end_ofs(struct file *file, struct address_space *mapping,
        int written;
 
        from = pos & (PAGE_SIZE - 1);
-       to = pos + len;
+       to = from + len;
        /*
         * XXX: not sure if this can handle short copies (len < copied), but
         * we don't have to, because the page should always be uptodate here,