Skip to content

Commit 27d7c2a

Browse files
Dan Carpentertorvalds
authored andcommitted
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 <dan.carpenter@oracle.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent df2fc24 commit 27d7c2a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/buffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2935,7 +2935,7 @@ static void guard_bh_eod(int rw, struct bio *bio, struct buffer_head *bh)
29352935
bio->bi_io_vec[0].bv_len = bytes;
29362936

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

0 commit comments

Comments
 (0)