Skip to content

Commit

Permalink
vfs: clear to the end of the buffer on partial buffer reads
Browse files Browse the repository at this point in the history
READ is zero so the "rw & READ" test is always false.  The intended test
was "((rw & RW_MASK) == READ)".

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Dan Carpenter authored and Linus Torvalds committed Dec 5, 2012
1 parent df2fc24 commit 27d7c2a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 27d7c2a

Please sign in to comment.