Commit 0bacbe52 authored by Al Viro's avatar Al Viro Committed by Al Viro

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: default avatarInsu Yun <wuninsu@gmail.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 0e9a7da5
...@@ -511,8 +511,6 @@ affs_do_readpage_ofs(struct page *page, unsigned to) ...@@ -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, pr_debug("%s(%lu, %ld, 0, %d)\n", __func__, inode->i_ino,
page->index, to); page->index, to);
BUG_ON(to > PAGE_CACHE_SIZE); BUG_ON(to > PAGE_CACHE_SIZE);
kmap(page);
data = page_address(page);
bsize = AFFS_SB(sb)->s_data_blksize; bsize = AFFS_SB(sb)->s_data_blksize;
tmp = page->index << PAGE_CACHE_SHIFT; tmp = page->index << PAGE_CACHE_SHIFT;
bidx = tmp / bsize; bidx = tmp / bsize;
...@@ -524,14 +522,15 @@ affs_do_readpage_ofs(struct page *page, unsigned to) ...@@ -524,14 +522,15 @@ affs_do_readpage_ofs(struct page *page, unsigned to)
return PTR_ERR(bh); return PTR_ERR(bh);
tmp = min(bsize - boff, to - pos); tmp = min(bsize - boff, to - pos);
BUG_ON(pos + tmp > to || tmp > bsize); BUG_ON(pos + tmp > to || tmp > bsize);
data = kmap_atomic(page);
memcpy(data + pos, AFFS_DATA(bh) + boff, tmp); memcpy(data + pos, AFFS_DATA(bh) + boff, tmp);
kunmap_atomic(data);
affs_brelse(bh); affs_brelse(bh);
bidx++; bidx++;
pos += tmp; pos += tmp;
boff = 0; boff = 0;
} }
flush_dcache_page(page); flush_dcache_page(page);
kunmap(page);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment