linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	Romain Francoise <romain@orebokech.com>,
	Meelis Roos <mroos@linux.ee>, Tony Luck <tony.luck@intel.com>
Subject: [patch v2] vfs: clear to the end of the buffer on reads
Date: Wed, 5 Dec 2012 20:01:24 +0300	[thread overview]
Message-ID: <20121205170124.GA21549@elgon.mountain> (raw)
In-Reply-To: <CA+55aFyCuepCzYq4zsLJyMO0yKzb=jD0-zv9zG6RyFYABOGe5w@mail.gmail.com>

READ is zero so this test is always false.  If ((rw & RW_MASK) == READ)
was intended.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: I didn't mask out the other flags in the first version

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 & RW_MASK) == READ) {
 		void *kaddr = kmap_atomic(bh->b_page);
 		memset(kaddr + bh_offset(bh) + bytes, 0, bh->b_size - bytes);
 		kunmap_atomic(kaddr);


      parent reply	other threads:[~2012-12-05 17:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-05 12:44 [patch] vfs: clear to the end of the buffer on reads Dan Carpenter
2012-12-05 15:17 ` Linus Torvalds
2012-12-05 16:59   ` Dan Carpenter
2012-12-05 17:01   ` Dan Carpenter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121205170124.GA21549@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mroos@linux.ee \
    --cc=romain@orebokech.com \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).