From: Dan Carpenter Date: Wed, 5 Dec 2012 17:01:24 +0000 (+0300) Subject: vfs: clear to the end of the buffer on partial buffer reads X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=27d7c2a006a81c04fab00b8cd81b99af3b32738d;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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: Dan Carpenter Signed-off-by: Linus Torvalds --- diff --git a/fs/buffer.c b/fs/buffer.c index c4e11390a44c..ec0aca8ba6bf 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -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);