diff options
author | Al Viro <viro@ZenIV.linux.org.uk> | 2016-02-02 02:28:05 +0000 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-02-20 00:15:51 -0500 |
commit | 0bacbe528e26422e424d110ebda4ec68ea0fd5eb (patch) | |
tree | 2781e7f0e0448d30efd5e50fd7ea4a3c6d4f19dc /fs/affs | |
parent | 0e9a7da51b028aee7a72c95096c99fe5ea2a01f0 (diff) | |
download | linux-0bacbe528e26422e424d110ebda4ec68ea0fd5eb.tar.gz linux-0bacbe528e26422e424d110ebda4ec68ea0fd5eb.tar.bz2 linux-0bacbe528e26422e424d110ebda4ec68ea0fd5eb.zip |
affs_do_readpage_ofs(): just use kmap_atomic() around memcpy()
It forgets kunmap() on a failure exit, but there's really no point keeping
the page kmapped at all - after all, what we are doing is a bunch of memcpy()
into the parts of page, so kmap_atomic()/kunmap_atomic() just around those
memcpy() is enough.
Spotted-by: Insu Yun <wuninsu@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/affs')
-rw-r--r-- | fs/affs/file.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/affs/file.c b/fs/affs/file.c index 0548c53f41d5..22fc7c802d69 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c @@ -511,8 +511,6 @@ affs_do_readpage_ofs(struct page *page, unsigned to) pr_debug("%s(%lu, %ld, 0, %d)\n", __func__, inode->i_ino, page->index, to); BUG_ON(to > PAGE_CACHE_SIZE); - kmap(page); - data = page_address(page); bsize = AFFS_SB(sb)->s_data_blksize; tmp = page->index << PAGE_CACHE_SHIFT; bidx = tmp / bsize; @@ -524,14 +522,15 @@ affs_do_readpage_ofs(struct page *page, unsigned to) return PTR_ERR(bh); tmp = min(bsize - boff, to - pos); BUG_ON(pos + tmp > to || tmp > bsize); + data = kmap_atomic(page); memcpy(data + pos, AFFS_DATA(bh) + boff, tmp); + kunmap_atomic(data); affs_brelse(bh); bidx++; pos += tmp; boff = 0; } flush_dcache_page(page); - kunmap(page); return 0; } |