kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] erofs: fix return value check in erofs_read_superblock()
@ 2019-09-18  8:30 Wei Yongjun
  2019-09-18  8:33 ` Gao Xiang
  2019-09-19  0:54 ` Chao Yu
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2019-09-18  8:30 UTC (permalink / raw)
  To: Gao Xiang, Chao Yu, Gao Xiang
  Cc: linux-erofs, kernel-janitors, Wei Yongjun, linux-kernel

In case of error, the function read_mapping_page() returns
ERR_PTR() not NULL. The NULL test in the return value check
should be replaced with IS_ERR().

Fixes: fe7c2423570d ("erofs: use read_mapping_page instead of sb_bread")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 fs/erofs/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index caf9a95173b0..0e369494f2f2 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -105,9 +105,9 @@ static int erofs_read_superblock(struct super_block *sb)
 	int ret;
 
 	page = read_mapping_page(sb->s_bdev->bd_inode->i_mapping, 0, NULL);
-	if (!page) {
+	if (IS_ERR(page)) {
 		erofs_err(sb, "cannot read erofs superblock");
-		return -EIO;
+		return PTR_ERR(page);
 	}
 
 	sbi = EROFS_SB(sb);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] erofs: fix return value check in erofs_read_superblock()
  2019-09-18  8:30 [PATCH -next] erofs: fix return value check in erofs_read_superblock() Wei Yongjun
@ 2019-09-18  8:33 ` Gao Xiang
  2019-09-19  0:54 ` Chao Yu
  1 sibling, 0 replies; 3+ messages in thread
From: Gao Xiang @ 2019-09-18  8:33 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Greg Kroah-Hartman, kernel-janitors, linux-kernel, Gao Xiang,
	linux-erofs

Hi Yongjun,

On Wed, Sep 18, 2019 at 08:30:33AM +0000, Wei Yongjun wrote:
> In case of error, the function read_mapping_page() returns
> ERR_PTR() not NULL. The NULL test in the return value check
> should be replaced with IS_ERR().
> 
> Fixes: fe7c2423570d ("erofs: use read_mapping_page instead of sb_bread")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>


Right... That is my mistake on recent killing bh
transformation...

I have no idea this patch could be merged for -rc1
since I don't know Greg could still accept patches
or freezed...

Since it's an error handling path and trivial, if
it's some late, could I submit this later after
erofs is merged into mainline (if it's ok) for -rc1?
(or maybe -rc2?)

Thanks,
Gao Xiang

> ---
>  fs/erofs/super.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
> index caf9a95173b0..0e369494f2f2 100644
> --- a/fs/erofs/super.c
> +++ b/fs/erofs/super.c
> @@ -105,9 +105,9 @@ static int erofs_read_superblock(struct super_block *sb)
>  	int ret;
>  
>  	page = read_mapping_page(sb->s_bdev->bd_inode->i_mapping, 0, NULL);
> -	if (!page) {
> +	if (IS_ERR(page)) {
>  		erofs_err(sb, "cannot read erofs superblock");
> -		return -EIO;
> +		return PTR_ERR(page);
>  	}
>  
>  	sbi = EROFS_SB(sb);
> 
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] erofs: fix return value check in erofs_read_superblock()
  2019-09-18  8:30 [PATCH -next] erofs: fix return value check in erofs_read_superblock() Wei Yongjun
  2019-09-18  8:33 ` Gao Xiang
@ 2019-09-19  0:54 ` Chao Yu
  1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2019-09-19  0:54 UTC (permalink / raw)
  To: Wei Yongjun, Gao Xiang, Chao Yu, Gao Xiang
  Cc: kernel-janitors, linux-erofs, linux-kernel

On 2019/9/18 16:30, Wei Yongjun wrote:
> In case of error, the function read_mapping_page() returns
> ERR_PTR() not NULL. The NULL test in the return value check
> should be replaced with IS_ERR().
> 
> Fixes: fe7c2423570d ("erofs: use read_mapping_page instead of sb_bread")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-19  0:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-18  8:30 [PATCH -next] erofs: fix return value check in erofs_read_superblock() Wei Yongjun
2019-09-18  8:33 ` Gao Xiang
2019-09-19  0:54 ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).