Re: crypto-drbg: Deletion of unnecessary checks before the function call "kzfree"

2014-11-20 Thread SF Markus Elfring
> Sorry but you're too late as someone else has already fixed this :)

Thanks for your feedback.

https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/crypto/drbg.c?id=46f64f6ef978dc1f36ebaa50ed79c7c8386711ee

Regards,
Markus

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] crypto-drbg: Deletion of unnecessary checks before the function call "kzfree"

2014-11-20 Thread Herbert Xu
On Wed, Nov 19, 2014 at 10:20:32AM +0100, SF Markus Elfring wrote:
> From: Markus Elfring 
> Date: Wed, 19 Nov 2014 10:11:04 +0100
> 
> The kzfree() function tests whether its argument is NULL and then
> returns immediately. Thus the test around the call is not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring 

Sorry but you're too late as someone else has already fixed this :)

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] crypto-drbg: Deletion of unnecessary checks before the function call "kzfree"

2014-11-19 Thread SF Markus Elfring
From: Markus Elfring 
Date: Wed, 19 Nov 2014 10:11:04 +0100

The kzfree() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 crypto/drbg.c | 18 ++
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/crypto/drbg.c b/crypto/drbg.c
index a53ee09..b6f22d4 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -1151,8 +1151,7 @@ static int drbg_seed(struct drbg_state *drbg, struct 
drbg_string *pers,
drbg->reseed_ctr = 1;
 
 out:
-   if (entropy)
-   kzfree(entropy);
+   kzfree(entropy);
return ret;
 }
 
@@ -1161,19 +1160,15 @@ static inline void drbg_dealloc_state(struct drbg_state 
*drbg)
 {
if (!drbg)
return;
-   if (drbg->V)
-   kzfree(drbg->V);
+   kzfree(drbg->V);
drbg->V = NULL;
-   if (drbg->C)
-   kzfree(drbg->C);
+   kzfree(drbg->C);
drbg->C = NULL;
-   if (drbg->scratchpad)
-   kzfree(drbg->scratchpad);
+   kzfree(drbg->scratchpad);
drbg->scratchpad = NULL;
drbg->reseed_ctr = 0;
 #ifdef CONFIG_CRYPTO_FIPS
-   if (drbg->prev)
-   kzfree(drbg->prev);
+   kzfree(drbg->prev);
drbg->prev = NULL;
drbg->fips_primed = false;
 #endif
@@ -1293,8 +1288,7 @@ static int drbg_make_shadow(struct drbg_state *drbg, 
struct drbg_state **shadow)
return 0;
 
 err:
-   if (tmp)
-   kzfree(tmp);
+   kzfree(tmp);
return ret;
 }
 
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/