On Fri, Sep 15, 2023 at 03:58:08PM +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/checksum.c:736 bch2_fs_encryption_init()
> warn: missing error code here? 'bch2_sb_get_crypt()' failed. 'ret' = '0'
>
> fs/bcachefs/checksum.c
> 721 int bch2_fs_encryption_init(struct bch_fs *c)
> 722 {
> 723 struct bch_sb_field_crypt *crypt;
> 724 struct bch_key key;
> 725 int ret = 0;
> 726
> 727 c->sha256 = crypto_alloc_shash("sha256", 0, 0);
> 728 ret = PTR_ERR_OR_ZERO(c->sha256);
> 729 if (ret) {
> 730 bch_err(c, "error requesting sha256 module: %s",
> bch2_err_str(ret));
> 731 goto out;
> 732 }
> 733
> 734 crypt = bch2_sb_get_crypt(c->disk_sb.sb);
> 735 if (!crypt)
> --> 736 goto out;
>
> ret = -ENOMEM;?
Not a bug - if there's no crypt section, the filesystem doesn't have
encryption enabled.