Skip to content

Commit b082c4b

Browse files
committed
Merge tag 'keys-next-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd
Pull keys update from Jarkko Sakkinen: "This contains only three fixes" * tag 'keys-next-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd: keys: Fix grammar and formatting in 'struct key_type' comments keys: Replace deprecated strncpy in ecryptfs_fill_auth_tok keys: Remove redundant less-than-zero checks
2 parents f2310b6 + 8c8e3df commit b082c4b

6 files changed

Lines changed: 13 additions & 11 deletions

File tree

include/linux/key-type.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,14 @@ struct key_type {
107107
*/
108108
int (*match_preparse)(struct key_match_data *match_data);
109109

110-
/* Free preparsed match data (optional). This should be supplied it
111-
* ->match_preparse() is supplied. */
110+
/*
111+
* Free preparsed match data (optional). This should be supplied if
112+
* ->match_preparse() is supplied.
113+
*/
112114
void (*match_free)(struct key_match_data *match_data);
113115

114-
/* clear some of the data from a key on revokation (optional)
116+
/*
117+
* Clear some of the data from a key on revocation (optional).
115118
* - the key's semaphore will be write-locked by the caller
116119
*/
117120
void (*revoke)(struct key *key);

security/keys/big_key.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ int big_key_preparse(struct key_preparsed_payload *prep)
6666

6767
BUILD_BUG_ON(sizeof(*payload) != sizeof(prep->payload.data));
6868

69-
if (datalen <= 0 || datalen > 1024 * 1024 || !prep->data)
69+
if (datalen == 0 || datalen > 1024 * 1024 || !prep->data)
7070
return -EINVAL;
7171

7272
/* Set an arbitrary quota */

security/keys/encrypted-keys/ecryptfs_format.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ int ecryptfs_fill_auth_tok(struct ecryptfs_auth_tok *auth_tok,
5454
auth_tok->version = (((uint16_t)(major << 8) & 0xFF00)
5555
| ((uint16_t)minor & 0x00FF));
5656
auth_tok->token_type = ECRYPTFS_PASSWORD;
57-
strncpy((char *)auth_tok->token.password.signature, key_desc,
58-
ECRYPTFS_PASSWORD_SIG_SIZE);
57+
strscpy_pad(auth_tok->token.password.signature, key_desc);
5958
auth_tok->token.password.session_key_encryption_key_bytes =
6059
ECRYPTFS_MAX_KEY_BYTES;
6160
/*

security/keys/encrypted-keys/encrypted.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ static int encrypted_instantiate(struct key *key,
795795
size_t datalen = prep->datalen;
796796
int ret;
797797

798-
if (datalen <= 0 || datalen > 32767 || !prep->data)
798+
if (datalen == 0 || datalen > 32767 || !prep->data)
799799
return -EINVAL;
800800

801801
datablob = kmalloc(datalen + 1, GFP_KERNEL);
@@ -856,7 +856,7 @@ static int encrypted_update(struct key *key, struct key_preparsed_payload *prep)
856856

857857
if (key_is_negative(key))
858858
return -ENOKEY;
859-
if (datalen <= 0 || datalen > 32767 || !prep->data)
859+
if (datalen == 0 || datalen > 32767 || !prep->data)
860860
return -EINVAL;
861861

862862
buf = kmalloc(datalen + 1, GFP_KERNEL);

security/keys/trusted-keys/trusted_core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static int trusted_instantiate(struct key *key,
157157
int key_cmd;
158158
size_t key_len;
159159

160-
if (datalen <= 0 || datalen > 32767 || !prep->data)
160+
if (datalen == 0 || datalen > 32767 || !prep->data)
161161
return -EINVAL;
162162

163163
orig_datablob = datablob = kmalloc(datalen + 1, GFP_KERNEL);
@@ -240,7 +240,7 @@ static int trusted_update(struct key *key, struct key_preparsed_payload *prep)
240240
p = key->payload.data[0];
241241
if (!p->migratable)
242242
return -EPERM;
243-
if (datalen <= 0 || datalen > 32767 || !prep->data)
243+
if (datalen == 0 || datalen > 32767 || !prep->data)
244244
return -EINVAL;
245245

246246
orig_datablob = datablob = kmalloc(datalen + 1, GFP_KERNEL);

security/keys/user_defined.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ int user_preparse(struct key_preparsed_payload *prep)
6161
struct user_key_payload *upayload;
6262
size_t datalen = prep->datalen;
6363

64-
if (datalen <= 0 || datalen > 32767 || !prep->data)
64+
if (datalen == 0 || datalen > 32767 || !prep->data)
6565
return -EINVAL;
6666

6767
upayload = kmalloc(sizeof(*upayload) + datalen, GFP_KERNEL);

0 commit comments

Comments
 (0)