diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-01-03 23:43:03 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2022-01-04 19:56:40 -0500 |
commit | 931ed5a709c2afa239cbae2e13bc22f13e99713c (patch) | |
tree | 3a9ab0ecee0188cdc1229192b5b8b8fbc3061707 /libbcachefs/checksum.c | |
parent | 69529e313666457c295ebb256f41126ca635b36b (diff) |
Update bcachefs sources to 50ac18afbb bcachefs: Fix an uninitialized variable
Diffstat (limited to 'libbcachefs/checksum.c')
-rw-r--r-- | libbcachefs/checksum.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/libbcachefs/checksum.c b/libbcachefs/checksum.c index fbe8603c..a1d89923 100644 --- a/libbcachefs/checksum.c +++ b/libbcachefs/checksum.c @@ -407,16 +407,12 @@ int bch2_rechecksum_bio(struct bch_fs *c, struct bio *bio, } #ifdef __KERNEL__ -int bch2_request_key(struct bch_sb *sb, struct bch_key *key) +static int __bch2_request_key(char *key_description, struct bch_key *key) { - char key_description[60]; struct key *keyring_key; const struct user_key_payload *ukp; int ret; - snprintf(key_description, sizeof(key_description), - "bcachefs:%pUb", &sb->user_uuid); - keyring_key = request_key(&key_type_logon, key_description, NULL); if (IS_ERR(keyring_key)) return PTR_ERR(keyring_key); @@ -436,16 +432,10 @@ int bch2_request_key(struct bch_sb *sb, struct bch_key *key) } #else #include <keyutils.h> -#include <uuid/uuid.h> -int bch2_request_key(struct bch_sb *sb, struct bch_key *key) +static int __bch2_request_key(char *key_description, struct bch_key *key) { key_serial_t key_id; - char key_description[60]; - char uuid[40]; - - uuid_unparse_lower(sb->user_uuid.b, uuid); - sprintf(key_description, "bcachefs:%s", uuid); key_id = request_key("user", key_description, NULL, KEY_SPEC_USER_KEYRING); @@ -459,6 +449,17 @@ int bch2_request_key(struct bch_sb *sb, struct bch_key *key) } #endif +int bch2_request_key(struct bch_sb *sb, struct bch_key *key) +{ + char key_description[60]; + char uuid[40]; + + uuid_unparse_lower(sb->user_uuid.b, uuid); + sprintf(key_description, "bcachefs:%s", uuid); + + return __bch2_request_key(key_description, key); +} + int bch2_decrypt_sb_key(struct bch_fs *c, struct bch_sb_field_crypt *crypt, struct bch_key *key) |