Skip to contentSkip to conversation

staging: erofs: fix error handling in __erofs_get_meta_page

PATCH New Gao Xiang 3 participants 4 messages Aug 20, 2018 Staging

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 staging: erofs: fix error handling in __erofs_get_meta_page

As Dan reported in LKP's mailing list:

https://lists.01.org/pipermail/kbuild-all/2018-August/051419.html

New smatch warnings:
drivers/staging/erofs/internal.h:446 erofs_grab_bio() warn: should 'blkaddr << (12 - 9)' be a 64 bit type? drivers/staging/erofs/data.c:78 __erofs_get_meta_page() error: 'bio' dereferencing possible ERR_PTR() drivers/staging/erofs/internal.h:446 erofs_grab_bio() warn: should 'blkaddr << (12 - 9)' be a 64 bit type?

Old smatch warnings:
drivers/staging/erofs/unzip_vle.c:989 z_erofs_vle_unzip() error: double unlock 'mutex:&z_pagemap_global_lock' drivers/staging/erofs/unzip_vle.c:1318 z_erofs_vle_normalaccess_readpage() warn: should 'page->index << 12' be a 64 bit type? drivers/staging/erofs/unzip_vle.c:1351 __z_erofs_vle_normalaccess_readpages() warn: should '()->index << 12' be a 64 bit type?

Signed-off-by Gao Xiang <gaoxiang25 at huawei.com>

---
Hi Chao,

Could you please fold this patch in the previous patch if it is convenient? `staging: erofs: separate erofs_get_meta_page'

It seems v2 of these patches has not been sent out to the staging mailing list.

Thanks,
Gao Xiang

 drivers/staging/erofs/data.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/erofs/data.c +2 -2
index 87a18a0..3c0d915 100644
@@ -63,9 +63,9 @@ struct page *__erofs_get_meta_page(struct super_block *sb,
 		struct bio *bio;
 
 		bio = erofs_grab_bio(sb, blkaddr, 1, read_endio, nofail);
-		if (unlikely(bio == NULL)) {
+		if (IS_ERR(bio)) {
 			DBG_BUGON(nofail);
-			err = -ENOMEM;
+			err = PTR_ERR(bio);
 			goto err_out;
 		}
 
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 staging: erofs: fix error handling in __erofs_get_meta_page

Quoted 15 lines · Gao Xiang

As Dan reported in LKP's mailing list:

https://lists.01.org/pipermail/kbuild-all/2018-August/051419.html

New smatch warnings:
drivers/staging/erofs/internal.h:446 erofs_grab_bio() warn: should 'blkaddr << (12 - 9)' be a 64 bit type? drivers/staging/erofs/data.c:78 __erofs_get_meta_page() error: 'bio' dereferencing possible ERR_PTR() drivers/staging/erofs/internal.h:446 erofs_grab_bio() warn: should 'blkaddr << (12 - 9)' be a 64 bit type?

Old smatch warnings:
drivers/staging/erofs/unzip_vle.c:989 z_erofs_vle_unzip() error: double unlock 'mutex:&z_pagemap_global_lock' drivers/staging/erofs/unzip_vle.c:1318 z_erofs_vle_normalaccess_readpage() warn: should 'page->index << 12' be a 64 bit type? drivers/staging/erofs/unzip_vle.c:1351 __z_erofs_vle_normalaccess_readpages() warn: should '()->index << 12' be a 64 bit type?

Signed-off-by Gao Xiang <gaoxiang25 at huawei.com>
Quoted 8 lines

---
Hi Chao,

Could you please fold this patch in the previous patch if it is convenient? `staging: erofs: separate erofs_get_meta_page'

It seems v2 of these patches has not been sent out to the staging mailing list.

Hi Xiang,

Let me merge this into previous buggy one. :)

Thanks,

Quoted 24 lines

Thanks,
Gao Xiang

 drivers/staging/erofs/data.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/erofs/data.c +2 -2
index 87a18a0..3c0d915 100644
@@ -63,9 +63,9 @@ struct page *__erofs_get_meta_page(struct super_block *sb,
 		struct bio *bio;
 
 		bio = erofs_grab_bio(sb, blkaddr, 1, read_endio, nofail);
-		if (unlikely(bio == NULL)) {
+		if (IS_ERR(bio)) {
 			DBG_BUGON(nofail);
-			err = -ENOMEM;
+			err = PTR_ERR(bio);
 			goto err_out;
 		}
 
#2 lore raw

PATCH 1/1 staging: erofs: fix error handling in __erofs_get_meta_page

Hi Chao,

Quoted 22 lines · Chao Yu
Quoted 21 lines · Gao Xiang

As Dan reported in LKP's mailing list:

https://lists.01.org/pipermail/kbuild-all/2018-August/051419.html

New smatch warnings:
drivers/staging/erofs/internal.h:446 erofs_grab_bio() warn: should 'blkaddr << (12 - 9)' be a 64 bit type? drivers/staging/erofs/data.c:78 __erofs_get_meta_page() error: 'bio' dereferencing possible ERR_PTR() drivers/staging/erofs/internal.h:446 erofs_grab_bio() warn: should 'blkaddr << (12 - 9)' be a 64 bit type?

Old smatch warnings:
drivers/staging/erofs/unzip_vle.c:989 z_erofs_vle_unzip() error: double unlock 'mutex:&z_pagemap_global_lock' drivers/staging/erofs/unzip_vle.c:1318 z_erofs_vle_normalaccess_readpage() warn: should 'page->index << 12' be a 64 bit type? drivers/staging/erofs/unzip_vle.c:1351 __z_erofs_vle_normalaccess_readpages() warn: should '()->index << 12' be a 64 bit type?

Signed-off-by Gao Xiang <gaoxiang25 at huawei.com>

---
Hi Chao,

Could you please fold this patch in the previous patch if it is convenient? `staging: erofs: separate erofs_get_meta_page'

Quoted 8 lines
Quoted 2 lines

It seems v2 of these patches has not been sent out to the staging mailing list.

Hi Xiang,

Let me merge this into previous buggy one. :)

Thanks,

Thanks for your quick patching :)

one more picky...
LINK:
https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/tree/drivers/staging/erofs/data.c?h=erofs&id=418b414392c2b6e588670a672489dfd015d80bc1#n66

if (unlikely(IS_ERR(bio))) { ===> if (IS_ERR(bio)) {

since

#define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)

static inline bool __must_check IS_ERR(__force const void *ptr)

{
	return IS_ERR_VALUE((unsigned long)ptr);
}

Thanks,
Gao Xiang

#3 lore raw

PATCH 1/1 staging: erofs: fix error handling in __erofs_get_meta_page

Quoted 34 lines · Gao Xiang

Hi Chao,

Quoted 22 lines · Chao Yu
Quoted 21 lines · Gao Xiang

As Dan reported in LKP's mailing list:

https://lists.01.org/pipermail/kbuild-all/2018-August/051419.html

New smatch warnings:
drivers/staging/erofs/internal.h:446 erofs_grab_bio() warn: should 'blkaddr << (12 - 9)' be a 64 bit type? drivers/staging/erofs/data.c:78 __erofs_get_meta_page() error: 'bio' dereferencing possible ERR_PTR() drivers/staging/erofs/internal.h:446 erofs_grab_bio() warn: should 'blkaddr << (12 - 9)' be a 64 bit type?

Old smatch warnings:
drivers/staging/erofs/unzip_vle.c:989 z_erofs_vle_unzip() error: double unlock 'mutex:&z_pagemap_global_lock' drivers/staging/erofs/unzip_vle.c:1318 z_erofs_vle_normalaccess_readpage() warn: should 'page->index << 12' be a 64 bit type? drivers/staging/erofs/unzip_vle.c:1351 __z_erofs_vle_normalaccess_readpages() warn: should '()->index << 12' be a 64 bit type?

Signed-off-by Gao Xiang <gaoxiang25 at huawei.com>

---
Hi Chao,

Could you please fold this patch in the previous patch if it is convenient? `staging: erofs: separate erofs_get_meta_page'

Quoted 8 lines
Quoted 2 lines

It seems v2 of these patches has not been sent out to the staging mailing list.

Hi Xiang,

Let me merge this into previous buggy one. :)

Thanks,

Quoted 7 lines

Thanks for your quick patching :)

one more picky...
LINK:
https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git/tree/drivers/staging/erofs/data.c?h=erofs&id=418b414392c2b6e588670a672489dfd015d80bc1#n66

if (unlikely(IS_ERR(bio))) { ===> if (IS_ERR(bio)) {

Alright, let me update it. I missed this due to manually merging by myself, it looks that git-am your entire eml-format patch will be better. :)

Thanks,

Quoted 14 lines

since

#define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)

static inline bool __must_check IS_ERR(__force const void *ptr)

{
	return IS_ERR_VALUE((unsigned long)ptr);
}

Thanks,
Gao Xiang