On Thu, Oct 12, 2023 at 12:43:46PM +0300, Dan Carpenter wrote:
> Hello Kent Overstreet,
> 
> The patch e0750d947352: "bcachefs: Initial commit" from Mar 16, 2017
> (linux-next), leads to the following Smatch static checker warning:
> 
>       fs/bcachefs/btree_update_interior.c:2336 __bch2_btree_root_alloc()
>       error: 'b' dereferencing possible ERR_PTR()
> 
> fs/bcachefs/btree_update_interior.c
>     2319 static int __bch2_btree_root_alloc(struct btree_trans *trans, enum 
> btree_id id)
>     2320 {
>     2321         struct bch_fs *c = trans->c;
>     2322         struct closure cl;
>     2323         struct btree *b;
>     2324         int ret;
>     2325 
>     2326         closure_init_stack(&cl);
>     2327 
>     2328         do {
>     2329                 ret = bch2_btree_cache_cannibalize_lock(c, &cl);
>     2330                 closure_sync(&cl);
>     2331         } while (ret);
>     2332 
>     2333         b = bch2_btree_node_mem_alloc(trans, false);
> 
> Smatch complains that bch2_btree_node_mem_alloc() can fail
> 
>     2334         bch2_btree_cache_cannibalize_unlock(c);
>     2335 
> --> 2336         set_btree_node_fake(b);
>                                      ^
> Leading to a crash.

Smatch still complains about this in linux-next.

regards,
dan carpenter



Reply via email to