Skip to contentSkip to conversation

FS-Cache: Fix bounds check

PATCH In review David Howells 1 participant 2 messages Jul 13, 2011 1 message not in the archive

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 FS-Cache: Fix bounds check

In reply to a message not in the archive

__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?]

---

 fs/fscache/page.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/fscache/page.c +1 -1
index 60315b3..112359d 100644
@@ -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++) {
#2 lore raw

Sigh... In reply to the wrong message; sorry about that.