From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: [patch] vfs: clear to the end of the buffer on reads Date: Wed, 5 Dec 2012 15:44:03 +0300 Message-ID: <20121205124403.GA31930@elgon.mountain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, kernel-janitors@vger.kernel.org, Romain Francoise , Meelis Roos , Tony Luck To: Alexander Viro , Linus Torvalds Return-path: Received: from userp1040.oracle.com ([156.151.31.81]:28870 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751587Ab2LEMoY (ORCPT ); Wed, 5 Dec 2012 07:44:24 -0500 Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: READ is zero so this test is always false. (rw == READ) was intended. Signed-off-by: Dan Carpenter diff --git a/fs/buffer.c b/fs/buffer.c index 70ed4d8..e0a59c6 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2931,7 +2931,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 == READ) { void *kaddr = kmap_atomic(bh->b_page); memset(kaddr + bh_offset(bh) + bytes, 0, bh->b_size - bytes); kunmap_atomic(kaddr);