keys: Remove redundant less-than-zero checks
The local variables 'size_t datalen' are unsigned and cannot be less than zero. Remove the redundant conditions. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Reviewed-by: Mimi Zohar <zohar@linux.ibm.com> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>pull/1354/merge
parent
e1afacb685
commit
58b46219bf
|
|
@ -66,7 +66,7 @@ int big_key_preparse(struct key_preparsed_payload *prep)
|
|||
|
||||
BUILD_BUG_ON(sizeof(*payload) != sizeof(prep->payload.data));
|
||||
|
||||
if (datalen <= 0 || datalen > 1024 * 1024 || !prep->data)
|
||||
if (datalen == 0 || datalen > 1024 * 1024 || !prep->data)
|
||||
return -EINVAL;
|
||||
|
||||
/* Set an arbitrary quota */
|
||||
|
|
|
|||
|
|
@ -795,7 +795,7 @@ static int encrypted_instantiate(struct key *key,
|
|||
size_t datalen = prep->datalen;
|
||||
int ret;
|
||||
|
||||
if (datalen <= 0 || datalen > 32767 || !prep->data)
|
||||
if (datalen == 0 || datalen > 32767 || !prep->data)
|
||||
return -EINVAL;
|
||||
|
||||
datablob = kmalloc(datalen + 1, GFP_KERNEL);
|
||||
|
|
@ -856,7 +856,7 @@ static int encrypted_update(struct key *key, struct key_preparsed_payload *prep)
|
|||
|
||||
if (key_is_negative(key))
|
||||
return -ENOKEY;
|
||||
if (datalen <= 0 || datalen > 32767 || !prep->data)
|
||||
if (datalen == 0 || datalen > 32767 || !prep->data)
|
||||
return -EINVAL;
|
||||
|
||||
buf = kmalloc(datalen + 1, GFP_KERNEL);
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ static int trusted_instantiate(struct key *key,
|
|||
int key_cmd;
|
||||
size_t key_len;
|
||||
|
||||
if (datalen <= 0 || datalen > 32767 || !prep->data)
|
||||
if (datalen == 0 || datalen > 32767 || !prep->data)
|
||||
return -EINVAL;
|
||||
|
||||
orig_datablob = datablob = kmalloc(datalen + 1, GFP_KERNEL);
|
||||
|
|
@ -240,7 +240,7 @@ static int trusted_update(struct key *key, struct key_preparsed_payload *prep)
|
|||
p = key->payload.data[0];
|
||||
if (!p->migratable)
|
||||
return -EPERM;
|
||||
if (datalen <= 0 || datalen > 32767 || !prep->data)
|
||||
if (datalen == 0 || datalen > 32767 || !prep->data)
|
||||
return -EINVAL;
|
||||
|
||||
orig_datablob = datablob = kmalloc(datalen + 1, GFP_KERNEL);
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ int user_preparse(struct key_preparsed_payload *prep)
|
|||
struct user_key_payload *upayload;
|
||||
size_t datalen = prep->datalen;
|
||||
|
||||
if (datalen <= 0 || datalen > 32767 || !prep->data)
|
||||
if (datalen == 0 || datalen > 32767 || !prep->data)
|
||||
return -EINVAL;
|
||||
|
||||
upayload = kmalloc(sizeof(*upayload) + datalen, GFP_KERNEL);
|
||||
|
|
|
|||
Loading…
Reference in New Issue