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>
This commit is contained in:
David Howells 2007-05-10 22:22:19 -07:00 коммит произвёл Linus Torvalds
Родитель 9393e1dc8e
Коммит 9d577b6a31
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -395,8 +395,9 @@ static int afs_write_back_from_locked_page(struct afs_writeback *wb,
if (n == 0)
goto no_more;
if (pages[0]->index != start) {
for (n--; n >= 0; n--)
put_page(pages[n]);
do {
put_page(pages[--n]);
} while (n > 0);
goto no_more;
}