Re: [PATCH] bcachefs: Fix possible pointer dereference

Kent Overstreet <[email protected]> Wed, 6 Aug 2025 10:08:53 -0400
Newsgroups org.kernel.vger.linux-bcachefs
Message-ID <ki5kkqdlqkpaurjtojsm5ltvcphf2lwyz2ygjfdeqsu5oj7znz@xgv2lenx5gij>
On Wed, Aug 06, 2025 at 08:20:18PM +0800, Alan Huang wrote:
> c hasn't been set yet here.
> 
> Reported-by: Dan Carpenter <[email protected]>
> Fixes: 09b9c72bd4b7 ("bcachefs: bch_err_throw()")
> Signed-off-by: Alan Huang <[email protected]>

Beat you to it, I fixed this one yesterday :)

> ---
>  fs/bcachefs/super.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
> index b0019488f586..5992ca040bf6 100644
> --- a/fs/bcachefs/super.c
> +++ b/fs/bcachefs/super.c
> @@ -2369,7 +2369,7 @@ struct bch_fs *bch2_fs_open(darray_const_str *devices,
>  	}
>  
>  	if (opts->nochanges && !opts->read_only) {
> -		ret = bch_err_throw(c, erofs_nochanges);
> +		ret = -BCH_ERR_erofs_nochanges;
>  		goto err_print;
>  	}
>  
> -- 
> 2.49.0
>