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;?
37
738 ret = bch2_alloc_ciphers(c);
739 if (ret)
740 goto out;
741
742 ret = bch2_decrypt_sb_key(c, crypt, &key);
743 if (ret)
744 goto out;
745
746 ret = crypto_skcipher_setkey(&c->chacha20->base,
747 (void *) &key.key, sizeof(key.key));
748 if (ret)
749 goto out;
750 out:
751 memzero_explicit(&key, sizeof(key));
752 return ret;
753 }
regards,
dan carpenter