[PATCH] bcachefs: Fix possible pointer dereference

Alan Huang <[email protected]> Wed, 6 Aug 2025 20:20:18 +0800
Newsgroups org.kernel.vger.linux-bcachefs
Message-ID <[email protected]>
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]>
---
 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