aboutsummaryrefslogtreecommitdiff
path: root/security/keys/encrypted-keys
diff options
context:
space:
mode:
authorThorsten Blum <thorsten.blum@linux.dev>2025-10-11 16:48:24 +0200
committerJarkko Sakkinen <jarkko@kernel.org>2025-11-27 23:50:20 +0200
commit58b46219bfcf1906b795307372b0d50d65115026 (patch)
treea90c28ee27a5ab0244cf178891f51ebcdaf73f64 /security/keys/encrypted-keys
parente1afacb68573c3cd0a3785c6b0508876cd3423bc (diff)
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>
Diffstat (limited to 'security/keys/encrypted-keys')
-rw-r--r--security/keys/encrypted-keys/encrypted.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/security/keys/encrypted-keys/encrypted.c b/security/keys/encrypted-keys/encrypted.c
index 513c09e2b01c..596e7a30bd3c 100644
--- a/security/keys/encrypted-keys/encrypted.c
+++ b/security/keys/encrypted-keys/encrypted.c
@@ -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);