Skip to content

Commit e44be00

Browse files
committed
hostfs: fix folio conversion
Commit e3ec0fe ("hostfs: Convert hostfs_read_folio() to use a folio") simplified hostfs_read_folio(), but in the process of converting to using folios natively also mis-used the folio_zero_tail() function due to the very confusing API of that function. Very arguably it's folio_zero_tail() API itself that is buggy, since it would make more sense (and the documentation kind of implies) that the third argument would be the pointer to the beginning of the folio buffer. But no, the third argument to folio_zero_tail() is where we should start zeroing the tail (even if we already also pass in the offset separately as the second argument). So fix the hostfs caller, and we can leave any folio_zero_tail() sanity cleanup for later. Reported-and-tested-by: Maciej Żenczykowski <[email protected]> Fixes: e3ec0fe ("hostfs: Convert hostfs_read_folio() to use a folio") Link: https://lore.kernel.org/all/CANP3RGceNzwdb7w=vPf5=7BCid5HVQDmz1K5kC9JG42+HVAh_g@mail.gmail.com/ Cc: Matthew Wilcox <[email protected]> Cc: Christian Brauner <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 786c824 commit e44be00

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/hostfs/hostfs_kern.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ static int hostfs_read_folio(struct file *file, struct folio *folio)
455455
if (bytes_read < 0)
456456
ret = bytes_read;
457457
else
458-
buffer = folio_zero_tail(folio, bytes_read, buffer);
458+
buffer = folio_zero_tail(folio, bytes_read, buffer + bytes_read);
459459
kunmap_local(buffer);
460460

461461
folio_end_read(folio, ret == 0);

0 commit comments

Comments
 (0)