mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: geert@linux-m68k.org
Cc: linux-kernel@vger.kernel.org, stable@kernel.org,
	David Howells <dhowells@redhat.com>
Subject: [PATCH] FS-Cache: Fix bounds check
Date: Wed, 13 Jul 2011 12:47:38 +0100	[thread overview]
Message-ID: <20110713114737.29760.95481.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <20110712124622.9331.83332.sendpatchset@squad5-lp1.lab.bos.redhat.com>

__fscache_uncache_all_inode_pages() has a loop that goes through page index
numbers go up to (loff_t)-1.  This is incorrect.  The limit should be
(pgoff_t)-1 as on a 32-bit machine the pgoff_t is smaller than loff_t.

On m68k the following error is observed:

fs/fscache/page.c: In function '__fscache_uncache_all_inode_pages':
fs/fscache/page.c:979: warning: comparison is always false due to
limited range of data type

[Should there be a PGOFF_T_MAX constant defined?]

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/fscache/page.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/fscache/page.c b/fs/fscache/page.c
index 60315b3..112359d 100644
--- a/fs/fscache/page.c
+++ b/fs/fscache/page.c
@@ -993,7 +993,7 @@ void __fscache_uncache_all_inode_pages(struct fscache_cookie *cookie,
 
 	pagevec_init(&pvec, 0);
 	next = 0;
-	while (next <= (loff_t)-1 &&
+	while (next <= (pgoff_t)-1 &&
 	       pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)
 	       ) {
 		for (i = 0; i < pagevec_count(&pvec); i++) {


       reply	other threads:[~2011-07-13 11:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20110712124622.9331.83332.sendpatchset@squad5-lp1.lab.bos.redhat.com>
2011-07-13 11:47 ` David Howells [this message]
2011-07-13 11:55 ` David Howells
2011-07-12 19:26 FS-Cache: Add a helper to bulk uncache pages on an inode Geert Uytterhoeven
2011-07-13 11:55 ` [PATCH] FS-Cache: Fix bounds check David Howells

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=20110713114737.29760.95481.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@kernel.org \
    /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

all inboxes | Powered by JetHome®