fix F-1234: IS_ERR Used on NULL-Returning Kernel Crypto Request Allocation Functions.

This commit is contained in:
Daniel Pouzzner
2026-06-08 17:37:13 -05:00
parent 63fd322382
commit 19a9670aaa
5 changed files with 20 additions and 38 deletions
+10 -12
View File
@@ -3118,10 +3118,10 @@ static int linuxkm_test_aescbc(void)
}
req = skcipher_request_alloc(tfm, GFP_KERNEL);
if (IS_ERR(req)) {
if (! req) {
ret = -ENOMEM;
pr_err("error: allocating AES skcipher request %s failed\n",
WOLFKM_AESCBC_DRIVER);
req = NULL;
goto test_cbc_end;
}
@@ -3320,10 +3320,10 @@ static int linuxkm_test_aescfb(void)
}
req = skcipher_request_alloc(tfm, GFP_KERNEL);
if (IS_ERR(req)) {
if (! req) {
ret = -ENOMEM;
pr_err("error: allocating AES skcipher request %s failed\n",
WOLFKM_AESCFB_DRIVER);
req = NULL;
goto test_cfb_end;
}
@@ -3586,10 +3586,10 @@ static int linuxkm_test_aesgcm(void)
}
req = aead_request_alloc(tfm, GFP_KERNEL);
if (IS_ERR(req)) {
if (! req) {
ret = -ENOMEM;
pr_err("error: allocating AES aead request %s failed: %ld\n",
WOLFKM_AESCBC_DRIVER, PTR_ERR(req));
req = NULL;
goto test_gcm_end;
}
@@ -4209,11 +4209,10 @@ static int aes_xts_128_test(void)
}
req = skcipher_request_alloc(tfm, GFP_KERNEL);
if (IS_ERR(req)) {
ret = PTR_ERR(req);
if (! req) {
ret = -ENOMEM;
pr_err("error: allocating AES skcipher request %s failed: %d\n",
WOLFKM_AESXTS_DRIVER, ret);
req = NULL;
goto test_xts_end;
}
@@ -4690,11 +4689,10 @@ static int aes_xts_256_test(void)
}
req = skcipher_request_alloc(tfm, GFP_KERNEL);
if (IS_ERR(req)) {
ret = PTR_ERR(req);
if (! req) {
ret = -ENOMEM;
pr_err("error: allocating AES skcipher request %s failed: %d\n",
WOLFKM_AESXTS_DRIVER, ret);
req = NULL;
goto test_xts_end;
}
+2 -6
View File
@@ -2878,14 +2878,10 @@ static int linuxkm_test_kpp_driver(const char * driver,
}
req = kpp_request_alloc(tfm, GFP_KERNEL);
if (IS_ERR(req)) {
if (! req) {
test_rc = -ENOMEM;
pr_err("error: allocating kpp request %s failed\n",
driver);
if (PTR_ERR(req) == -ENOMEM)
test_rc = MEMORY_E;
else
test_rc = BAD_FUNC_ARG;
req = NULL;
goto test_kpp_end;
}
+2 -6
View File
@@ -905,14 +905,10 @@ static int linuxkm_test_ecdh_nist_driver(const char * driver,
}
req = kpp_request_alloc(tfm, GFP_KERNEL);
if (IS_ERR(req)) {
if (! req) {
test_rc = -ENOMEM;
pr_err("error: allocating kpp request %s failed\n",
driver);
if (PTR_ERR(req) == -ENOMEM)
test_rc = MEMORY_E;
else
test_rc = BAD_FUNC_ARG;
req = NULL;
goto test_ecdh_nist_end;
}
+2 -6
View File
@@ -763,14 +763,10 @@ static int linuxkm_test_ecdsa_nist_driver(const char * driver,
}
req = akcipher_request_alloc(tfm, GFP_KERNEL);
if (IS_ERR(req)) {
if (! req) {
test_rc = -ENOMEM;
pr_err("error: allocating akcipher request %s failed\n",
driver);
if (PTR_ERR(req) == -ENOMEM)
test_rc = MEMORY_E;
else
test_rc = BAD_FUNC_ARG;
req = NULL;
goto test_ecdsa_nist_end;
}
+4 -8
View File
@@ -2267,10 +2267,10 @@ static int linuxkm_test_rsa_driver(const char * driver, int nbits)
}
req = akcipher_request_alloc(tfm, GFP_KERNEL);
if (IS_ERR(req)) {
if (! req) {
ret = -ENOMEM;
pr_err("error: allocating akcipher request %s failed\n",
driver);
req = NULL;
goto test_rsa_end;
}
@@ -2694,14 +2694,10 @@ static int linuxkm_test_pkcs1pad_driver(const char * driver, int nbits,
}
req = akcipher_request_alloc(tfm, GFP_KERNEL);
if (IS_ERR(req)) {
if (! req) {
test_rc = -ENOMEM;
pr_err("error: allocating akcipher request %s failed\n",
driver);
if (PTR_ERR(req) == -ENOMEM)
test_rc = MEMORY_E;
else
test_rc = BAD_FUNC_ARG;
req = NULL;
goto test_pkcs1_end;
}