Linux bcachefs list
 help / color / mirror / Atom feed
* [PATCH] bcachefs: Remove unused variable from bch2_fs_encryption_init()
@ 2025-04-02 16:22 Eric Biggers
  2025-04-02 16:27 ` Kent Overstreet
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Biggers @ 2025-04-02 16:22 UTC (permalink / raw)
  To: Kent Overstreet, linux-bcachefs

From: Eric Biggers <ebiggers@google.com>

The 'key' local variable is no longer used, now that the key is being
written directly to the struct bch_fs.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---

Please feel free to fold this into 
"bcachefs: use library APIs for ChaCha20 and Poly1305".

 fs/bcachefs/checksum.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/fs/bcachefs/checksum.c b/fs/bcachefs/checksum.c
index 7d1e3b908eecd..d0a34a097b809 100644
--- a/fs/bcachefs/checksum.c
+++ b/fs/bcachefs/checksum.c
@@ -682,20 +682,17 @@ void bch2_fs_encryption_exit(struct bch_fs *c)
 }
 
 int bch2_fs_encryption_init(struct bch_fs *c)
 {
 	struct bch_sb_field_crypt *crypt;
-	struct bch_key key;
-	int ret = 0;
+	int ret;
 
 	crypt = bch2_sb_field_get(c->disk_sb.sb, crypt);
 	if (!crypt)
-		goto out;
+		return 0;
 
 	ret = bch2_decrypt_sb_key(c, crypt, &c->chacha20_key);
 	if (ret)
-		goto out;
+		return ret;
 	c->chacha20_key_set = true;
-out:
-	memzero_explicit(&key, sizeof(key));
-	return ret;
+	return 0;
 }

base-commit: 04c4768d24f70d457ff49681ef726d5d23c089a5
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] bcachefs: Remove unused variable from bch2_fs_encryption_init()
  2025-04-02 16:22 [PATCH] bcachefs: Remove unused variable from bch2_fs_encryption_init() Eric Biggers
@ 2025-04-02 16:27 ` Kent Overstreet
  0 siblings, 0 replies; 2+ messages in thread
From: Kent Overstreet @ 2025-04-02 16:27 UTC (permalink / raw)
  To: Eric Biggers; +Cc: linux-bcachefs

On Wed, Apr 02, 2025 at 09:22:56AM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> The 'key' local variable is no longer used, now that the key is being
> written directly to the struct bch_fs.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>


Applied
> ---
> 
> Please feel free to fold this into 
> "bcachefs: use library APIs for ChaCha20 and Poly1305".
> 
>  fs/bcachefs/checksum.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/bcachefs/checksum.c b/fs/bcachefs/checksum.c
> index 7d1e3b908eecd..d0a34a097b809 100644
> --- a/fs/bcachefs/checksum.c
> +++ b/fs/bcachefs/checksum.c
> @@ -682,20 +682,17 @@ void bch2_fs_encryption_exit(struct bch_fs *c)
>  }
>  
>  int bch2_fs_encryption_init(struct bch_fs *c)
>  {
>  	struct bch_sb_field_crypt *crypt;
> -	struct bch_key key;
> -	int ret = 0;
> +	int ret;
>  
>  	crypt = bch2_sb_field_get(c->disk_sb.sb, crypt);
>  	if (!crypt)
> -		goto out;
> +		return 0;
>  
>  	ret = bch2_decrypt_sb_key(c, crypt, &c->chacha20_key);
>  	if (ret)
> -		goto out;
> +		return ret;
>  	c->chacha20_key_set = true;
> -out:
> -	memzero_explicit(&key, sizeof(key));
> -	return ret;
> +	return 0;
>  }
> 
> base-commit: 04c4768d24f70d457ff49681ef726d5d23c089a5
> -- 
> 2.49.0
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-02 16:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-02 16:22 [PATCH] bcachefs: Remove unused variable from bch2_fs_encryption_init() Eric Biggers
2025-04-02 16:27 ` Kent Overstreet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox