Skip to contentSkip to conversation

fs/affs: bugfix: Write files greater than page size on OFS

PATCH New Fabian Frederick 1 participant 1 message Apr 24, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 fs/affs: bugfix: Write files greater than page size on OFS

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

---
 fs/affs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/affs/file.c +1 -1
index e5c5de6..196ee7f 100644
@@ -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,
Signature · 1 line
2.9.3