lkml.org 
[lkml]   [2017]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] crypto-testmgr: Delete an error message for a failed memory allocation in two functions
Date
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 11 May 2017 17:05:17 +0200

Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
crypto/testmgr.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 6f5f3ed8376c..392bb4f95024 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -217,10 +217,9 @@ static int ahash_partial_update(struct ahash_request **preq,
statesize = crypto_ahash_statesize(
crypto_ahash_reqtfm(req));
state = kmalloc(statesize + sizeof(guard), GFP_KERNEL);
- if (!state) {
- pr_err("alt: hash: Failed to alloc state for %s\n", algo);
+ if (!state)
goto out_nostate;
- }
+
memcpy(state + statesize, guard, sizeof(guard));
ret = crypto_ahash_export(req, state);
WARN_ON(memcmp(state + statesize, guard, sizeof(guard)));
@@ -1632,11 +1631,8 @@ static int test_cprng(struct crypto_rng *tfm,
seedsize = crypto_rng_seedsize(tfm);

seed = kmalloc(seedsize, GFP_KERNEL);
- if (!seed) {
- printk(KERN_ERR "alg: cprng: Failed to allocate seed space "
- "for %s\n", algo);
+ if (!seed)
return -ENOMEM;
- }

for (i = 0; i < tcount; i++) {
memset(result, 0, 32);
--
2.12.3
\
 
 \ /
  Last update: 2017-05-11 17:14    [W:0.075 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site