Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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;
}