Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762105AbXEJNXR (ORCPT ); Thu, 10 May 2007 09:23:17 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758835AbXEJNXF (ORCPT ); Thu, 10 May 2007 09:23:05 -0400 Received: from mx1.redhat.com ([66.187.233.31]:39717 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755742AbXEJNXE convert rfc822-to-8bit (ORCPT ); Thu, 10 May 2007 09:23:04 -0400 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Charlie Peters (USA) and David Owens (Ireland) From: David Howells In-Reply-To: <10764.1178800398@redhat.com> References: <10764.1178800398@redhat.com> <20070510115927.GB16409@srv1-m700-lanp.koti> Cc: mikukkon@iki.fi, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Bug in fs/afs/write.c function afs_write_back_from_locked_page() X-Mailer: MH-E 8.0; nmh 1.1; GNU Emacs 22.0.50 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Date: Thu, 10 May 2007 13:35:24 +0100 Message-ID: <11285.1178800524@redhat.com> To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1479 Lines: 50 David Howells wrote: > How about the attached instead? Blech. How about this instead? I forgot to remove the extra put_page() you added. David --- AFS: Fix interminable loop in afs_write_back_from_locked_page() From: Mika Kukkonen 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 Signed-off-by: David Howells --- 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 67ae4db..28f3751 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, 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; } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/