diff mbox series

[v2] crypto: algboss: remove NULL check in cryptomgr_schedule_probe()

Message ID 20240401122258.111414-1-r.smirnov@omp.ru (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series [v2] crypto: algboss: remove NULL check in cryptomgr_schedule_probe() | expand

Commit Message

Roman Smirnov April 1, 2024, 12:22 p.m. UTC
The for loop will be executed at least once, so i > 0. If the loop
is interrupted before i is incremented (e.g., when checking len for NULL),
i will not be checked.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Signed-off-by: Roman Smirnov <r.smirnov@omp.ru>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
 crypto/algboss.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Herbert Xu April 12, 2024, 7:27 a.m. UTC | #1
On Mon, Apr 01, 2024 at 03:22:58PM +0300, Roman Smirnov wrote:
> The for loop will be executed at least once, so i > 0. If the loop
> is interrupted before i is incremented (e.g., when checking len for NULL),
> i will not be checked.
> 
> Found by Linux Verification Center (linuxtesting.org) with Svace.
> 
> Signed-off-by: Roman Smirnov <r.smirnov@omp.ru>
> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> ---
>  crypto/algboss.c | 3 ---
>  1 file changed, 3 deletions(-)

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/crypto/algboss.c b/crypto/algboss.c
index 0de1e6697949..1aa5f306998a 100644
--- a/crypto/algboss.c
+++ b/crypto/algboss.c
@@ -138,9 +138,6 @@  static int cryptomgr_schedule_probe(struct crypto_larval *larval)
 			goto err_free_param;
 	}
 
-	if (!i)
-		goto err_free_param;
-
 	param->tb[i + 1] = NULL;
 
 	param->type.attr.rta_len = sizeof(param->type);