From patchwork Wed Sep 19 18:05:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1478941 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id E3222DF280 for ; Wed, 19 Sep 2012 18:05:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932867Ab2ISSF1 (ORCPT ); Wed, 19 Sep 2012 14:05:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48368 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932791Ab2ISSF0 (ORCPT ); Wed, 19 Sep 2012 14:05:26 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8JI5Kmj029212 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 Sep 2012 14:05:21 -0400 Received: from corrin.poochiereds.net (ovpn-112-71.phx2.redhat.com [10.3.112.71]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q8JI5J31008772; Wed, 19 Sep 2012 14:05:20 -0400 Date: Wed, 19 Sep 2012 11:05:18 -0700 From: Jeff Layton To: smfrench@gmail.com Cc: Fengguang Wu , kernel-janitors@vger.kernel.org, linux-cifs@vger.kernel.org Subject: Re: [cifs:for-next 50/71] fs/cifs/file.c:3157:23-27: ERROR: invalid reference to the index variable of the iterator on line 3149 Message-ID: <20120919110518.05b707e5@corrin.poochiereds.net> In-Reply-To: <20120919062508.70ba65eb@corrin.poochiereds.net> References: <20120919050802.GA28801@localhost> <20120919062508.70ba65eb@corrin.poochiereds.net> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org On Wed, 19 Sep 2012 06:25:08 -0700 Jeff Layton wrote: > On Wed, 19 Sep 2012 13:08:02 +0800 > Fengguang Wu wrote: > > > Hi Jeff, > > > > FYI, there are new coccinelle warnings show up in > > > > tree: git://git.samba.org/sfrench/cifs-2.6.git for-next > > head: 324b53bbcd1d9795062f00e92064296169c9b081 > > commit: a4a23914d0d1736eb6d98049d303d551131df83c [50/71] cifs: turn the pages list in cifs_readdata into an array > > > > All coccinelle warnings: > > > > + fs/cifs/file.c:3157:23-27: ERROR: invalid reference to the index variable of the iterator on line 3149 > > > > vim +3157 fs/cifs/file.c > > 3147 rdata->marshal_iov = cifs_readpages_marshal_iov; > > 3148 > > > 3149 list_for_each_entry_safe(page, tpage, &tmplist, lru) { > > 3150 list_del(&page->lru); > > 3151 rdata->pages[rdata->nr_pages++] = page; > > 3152 } > > 3153 > > 3154 rc = cifs_retry_async_readv(rdata); > > 3155 if (rc != 0) { > > 3156 for (i = 0; i < rdata->nr_pages; i++) { > > > 3157 lru_cache_add_file(page); > > 3158 unlock_page(page); > > 3159 page_cache_release(page); > > 3160 } > > 3161 kref_put(&rdata->refcount, cifs_readdata_release); > > 3162 break; > > 3163 } > > 3164 > > 3165 kref_put(&rdata->refcount, cifs_readdata_release); > > 3166 } > > 3167 > > > > --- > > 0-DAY kernel build testing backend Open Source Technology Centre > > Fengguang Wu, Yuanhan Liu Intel Corporation > > > Thanks Wu, good catch. I've got a fix that I'll push to Steve today. > FWIW, here's the (trivial) patch to fix this. Steve, I've respun the patch that introduced this bug and pushed it out to my cifs-next branch. This should be the only difference. You If you'd rather do a patch on top of your tree instead, let me know... ---------------------------[snip]----------------------------- --- To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 1d43303..075f7cf 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -3280,6 +3280,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, rc = cifs_retry_async_readv(rdata); if (rc != 0) { for (i = 0; i < rdata->nr_pages; i++) { + page = rdata->pages[i]; lru_cache_add_file(page); unlock_page(page); page_cache_release(page);