summaryrefslogtreecommitdiff
path: root/fs/cifs
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2022-11-04 18:36:49 +0300
committerDavid Howells <dhowells@redhat.com>2022-11-15 19:56:07 +0300
commit5e51c627c5acbcf82bb552e17533a79d2a6a2600 (patch)
tree87de545c980f1bf2b6d750f64a44923333fef4e3 /fs/cifs
parent7e043a80b5dae5c2d2cf84031501de7827fd6c00 (diff)
downloadlinux-5e51c627c5acbcf82bb552e17533a79d2a6a2600.tar.xz
netfs: Fix dodgy maths
Fix the dodgy maths in netfs_rreq_unlock_folios(). start_page could be inside the folio, in which case the calculation of pgpos will be come up with a negative number (though for the moment rreq->start is rounded down earlier and folios would have to get merged whilst locked) Alter how this works to just frame the tracking in terms of absolute file positions, rather than offsets from the start of the I/O request. This simplifies the maths and makes it easier to follow. Fix the issue by using folio_pos() and folio_size() to calculate the end position of the page. Fixes: 3d3c95046742 ("netfs: Provide readahead and readpage netfs helpers") Reported-by: Matthew Wilcox <willy@infradead.org> Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Jingbo Xu <jefflexu@linux.alibaba.com> cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org Link: https://lore.kernel.org/r/Y2SJw7w1IsIik3nb@casper.infradead.org/ Link: https://lore.kernel.org/r/166757988611.950645.7626959069846893164.stgit@warthog.procyon.org.uk/ # v2
Diffstat (limited to 'fs/cifs')
0 files changed, 0 insertions, 0 deletions