Skip to contentSkip to conversation

bcachefs: Remove unused variable from bch2_fs_encryption_init()

PATCH Applied Eric Biggers 2 participants 2 messages Apr 2, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bcachefs: Remove unused variable from bch2_fs_encryption_init()

From: Eric Biggers <[email protected]>

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

---

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(-)
fs/bcachefs/checksum.c +4 -7
index 7d1e3b908eecd..d0a34a097b809 100644
@@ -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

Signature · 1 line
2.49.0
#1 lore raw
Quoted 6 lines · Eric Biggers

From: Eric Biggers <[email protected]>

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

Applied

Quoted 42 lines

---

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(-)
fs/bcachefs/checksum.c +4 -7
index 7d1e3b908eecd..d0a34a097b809 100644
@@ -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

Signature · 1 line
2.49.0