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

Commit 27d7c2a0 authored by Dan Carpenter's avatar Dan Carpenter Committed by Linus Torvalds
Browse files

vfs: clear to the end of the buffer on partial buffer reads



READ is zero so the "rw & READ" test is always false.  The intended test
was "((rw & RW_MASK) == READ)".

Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent df2fc246
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2935,7 +2935,7 @@ static void guard_bh_eod(int rw, struct bio *bio, struct buffer_head *bh)
	bio->bi_io_vec[0].bv_len = bytes;

	/* ..and clear the end of the buffer for reads */
	if (rw & READ) {
	if ((rw & RW_MASK) == READ) {
		void *kaddr = kmap_atomic(bh->b_page);
		memset(kaddr + bh_offset(bh) + bytes, 0, bh->b_size - bytes);
		kunmap_atomic(kaddr);