Skip to contentSkip to conversation

fs/cifs/file.c:3157:23-27: ERROR: invalid reference to the index variable of t

PATCH In review Fengguang Wu 3 participants 4 messages Sep 19, 2012 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 50/71 fs/cifs/file.c:3157:23-27: ERROR: invalid reference to the index variable of t

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

Quoted 1 line

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++) {

Quoted 1 line

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

#1 lore raw

Re: [cifs:for-next 50/71] fs/cifs/file.c:3157:23-27: ERROR: invalid reference to the index variable

Quoted 35 lines · On Wed, 19 Sep 2012 13:08:02 +0800 Fengguang Wu <[email protected]> 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

Quoted 1 line

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++) {

Quoted 1 line

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

Quoted 3 lines

---
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.

Signature · 1 line
Jeff Layton <[email protected]>

A message that is not in the archive (sent off-list or not yet received): 20120919062508.70ba65eb-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org

#3 lore raw

Re: [cifs:for-next 50/71] fs/cifs/file.c:3157:23-27: ERROR: invalid reference to the index variable

Quoted 38 lines · On Wed, 19 Sep 2012 06:25:08 -0700 Jeff Layton <[email protected]> wrote:
Quoted 35 lines · On Wed, 19 Sep 2012 13:08:02 +0800 Fengguang Wu <[email protected]> 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

Quoted 1 line

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++) {

Quoted 1 line

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

Quoted 7 lines
Quoted 3 lines

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

fs/cifs/file.c +1 -0
index 1d43303..075f7cf 100644
@@ -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);

A message that is not in the archive (sent off-list or not yet received): 20120919110518.05b707e5-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org

#5 lore raw

Re: [cifs:for-next 50/71] fs/cifs/file.c:3157:23-27: ERROR: invalid reference to the index variable

I repulled jeff's cifs-next into my fcifs-2.6. for-next. Added the fixes from Pavel (SMB2 endian fix, and memory leak) and the fix to allow us to negotiate "vers=3.0" - am rebuilding now but expect it do continue to do ok for simple smb2.1 and smb3.0 functional testing (sans signing) - with the known problem of lack of symlinks and rename of open files and cifsacl (chmod)

Quoted 69 lines · Jeff Layton
Quoted 38 lines · On Wed, 19 Sep 2012 06:25:08 -0700 Jeff Layton <[email protected]> wrote:
Quoted 35 lines · On Wed, 19 Sep 2012 13:08:02 +0800 Fengguang Wu <[email protected]> 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

Quoted 1 line

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++) {

Quoted 1 line

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

Quoted 7 lines
Quoted 3 lines

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

fs/cifs/file.c +1 -0
index 1d43303..075f7cf 100644
@@ -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);
Signature · 3 lines
Thanks,

Steve