diff options
author | David Howells <dhowells@redhat.com> | 2007-05-11 01:22:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-11 11:29:32 -0400 |
commit | 9d577b6a31a53a19d3b0fe414d645a61ef201846 (patch) | |
tree | 3e2523ac386e16eb0b125f3933b9ebfbd03aed65 /fs | |
parent | 9393e1dc8e394bd59217178b26b2476dc43e8667 (diff) |
AFS: fix interminable loop in afs_write_back_from_locked_page()
Following bug was uncovered by compiling with '-W' flag:
CC [M] fs/afs/write.o
fs/afs/write.c: In function âafs_write_back_from_locked_pageâ:
fs/afs/write.c:398: warning: comparison of unsigned expression >= 0 is always true
Loop variable 'n' is unsigned, so wraps around happily as far as I can
see. Trival fix attached (compile tested only).
Signed-off-by: Mika Kukkonen <mikukkon@iki.fi>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/afs/write.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/afs/write.c b/fs/afs/write.c index 67ae4dbf66b3..28f37516c126 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c | |||
@@ -395,8 +395,9 @@ static int afs_write_back_from_locked_page(struct afs_writeback *wb, | |||
395 | if (n == 0) | 395 | if (n == 0) |
396 | goto no_more; | 396 | goto no_more; |
397 | if (pages[0]->index != start) { | 397 | if (pages[0]->index != start) { |
398 | for (n--; n >= 0; n--) | 398 | do { |
399 | put_page(pages[n]); | 399 | put_page(pages[--n]); |
400 | } while (n > 0); | ||
400 | goto no_more; | 401 | goto no_more; |
401 | } | 402 | } |
402 | 403 | ||