* [bug report] bcachefs: missing error code in bch2_fs_encryption_init()
@ 2023-09-15 12:58 Dan Carpenter
2023-09-20 1:46 ` Kent Overstreet
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2023-09-15 12:58 UTC (permalink / raw)
To: kent.overstreet; +Cc: Brian Foster, linux-bcachefs
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] bcachefs: missing error code in bch2_fs_encryption_init()
2023-09-15 12:58 [bug report] bcachefs: missing error code in bch2_fs_encryption_init() Dan Carpenter
@ 2023-09-20 1:46 ` Kent Overstreet
0 siblings, 0 replies; 2+ messages in thread
From: Kent Overstreet @ 2023-09-20 1:46 UTC (permalink / raw)
To: Dan Carpenter; +Cc: kent.overstreet, Brian Foster, linux-bcachefs
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-20 1:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-15 12:58 [bug report] bcachefs: missing error code in bch2_fs_encryption_init() Dan Carpenter
2023-09-20 1:46 ` Kent Overstreet
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.