public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4 crypto: remove unneeded assignation
@ 2015-07-08 19:51 Laurent Navet
  2015-07-08 19:55 ` Joe Perches
  2015-07-08 20:01 ` Darrick J. Wong
  0 siblings, 2 replies; 4+ messages in thread
From: Laurent Navet @ 2015-07-08 19:51 UTC (permalink / raw)
  To: tytso, adilger.kernel; +Cc: linux-ext4, linux-kernel, Laurent Navet

Return value of ext4_derive_key_aes() is stored but never used before
being overwritten.
Also fix coverity CID 1309760.

Signed-off-by: Laurent Navet <laurent.navet@gmail.com>
---
 fs/ext4/crypto_key.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/crypto_key.c b/fs/ext4/crypto_key.c
index 442d24e..92f9172 100644
--- a/fs/ext4/crypto_key.c
+++ b/fs/ext4/crypto_key.c
@@ -218,7 +218,7 @@ retry:
 	BUILD_BUG_ON(EXT4_AES_128_ECB_KEY_SIZE !=
 		     EXT4_KEY_DERIVATION_NONCE_SIZE);
 	BUG_ON(master_key->size != EXT4_AES_256_XTS_KEY_SIZE);
-	res = ext4_derive_key_aes(ctx.nonce, master_key->raw,
+	ext4_derive_key_aes(ctx.nonce, master_key->raw,
 				  raw_key);
 got_key:
 	ctfm = crypto_alloc_ablkcipher(cipher_str, 0, 0);
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ext4 crypto: remove unneeded assignation
  2015-07-08 19:51 [PATCH] ext4 crypto: remove unneeded assignation Laurent Navet
@ 2015-07-08 19:55 ` Joe Perches
  2015-07-08 20:01 ` Darrick J. Wong
  1 sibling, 0 replies; 4+ messages in thread
From: Joe Perches @ 2015-07-08 19:55 UTC (permalink / raw)
  To: Laurent Navet; +Cc: tytso, adilger.kernel, linux-ext4, linux-kernel

On Wed, 2015-07-08 at 21:51 +0200, Laurent Navet wrote:
> Return value of ext4_derive_key_aes() is stored but never used before
> being overwritten.
> Also fix coverity CID 1309760.
> 
> Signed-off-by: Laurent Navet <laurent.navet@gmail.com>
> ---
>  fs/ext4/crypto_key.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/crypto_key.c b/fs/ext4/crypto_key.c
> index 442d24e..92f9172 100644
> --- a/fs/ext4/crypto_key.c
> +++ b/fs/ext4/crypto_key.c
> @@ -218,7 +218,7 @@ retry:
>  	BUILD_BUG_ON(EXT4_AES_128_ECB_KEY_SIZE !=
>  		     EXT4_KEY_DERIVATION_NONCE_SIZE);
>  	BUG_ON(master_key->size != EXT4_AES_256_XTS_KEY_SIZE);
> -	res = ext4_derive_key_aes(ctx.nonce, master_key->raw,
> +	ext4_derive_key_aes(ctx.nonce, master_key->raw,
>  				  raw_key);

More likely this should be:

	res = ext4_derive_key_aes(,,,);
	if (res)
		goto out;

>  got_key:
>  	ctfm = crypto_alloc_ablkcipher(cipher_str, 0, 0);




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ext4 crypto: remove unneeded assignation
  2015-07-08 19:51 [PATCH] ext4 crypto: remove unneeded assignation Laurent Navet
  2015-07-08 19:55 ` Joe Perches
@ 2015-07-08 20:01 ` Darrick J. Wong
  2015-07-09 19:04   ` Laurent Navet
  1 sibling, 1 reply; 4+ messages in thread
From: Darrick J. Wong @ 2015-07-08 20:01 UTC (permalink / raw)
  To: Laurent Navet; +Cc: tytso, adilger.kernel, linux-ext4, linux-kernel

On Wed, Jul 08, 2015 at 09:51:15PM +0200, Laurent Navet wrote:
> Return value of ext4_derive_key_aes() is stored but never used before
> being overwritten.
> Also fix coverity CID 1309760.
> 
> Signed-off-by: Laurent Navet <laurent.navet@gmail.com>
> ---
>  fs/ext4/crypto_key.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/crypto_key.c b/fs/ext4/crypto_key.c
> index 442d24e..92f9172 100644
> --- a/fs/ext4/crypto_key.c
> +++ b/fs/ext4/crypto_key.c
> @@ -218,7 +218,7 @@ retry:
>  	BUILD_BUG_ON(EXT4_AES_128_ECB_KEY_SIZE !=
>  		     EXT4_KEY_DERIVATION_NONCE_SIZE);
>  	BUG_ON(master_key->size != EXT4_AES_256_XTS_KEY_SIZE);
> -	res = ext4_derive_key_aes(ctx.nonce, master_key->raw,
> +	ext4_derive_key_aes(ctx.nonce, master_key->raw,
>  				  raw_key);

I don't think it's a good idea to drop the error code on the floor and keep
going as if nothing bad had happened.

--D

>  got_key:
>  	ctfm = crypto_alloc_ablkcipher(cipher_str, 0, 0);
> -- 
> 2.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ext4 crypto: remove unneeded assignation
  2015-07-08 20:01 ` Darrick J. Wong
@ 2015-07-09 19:04   ` Laurent Navet
  0 siblings, 0 replies; 4+ messages in thread
From: Laurent Navet @ 2015-07-09 19:04 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: tytso, adilger.kernel, linux-ext4, linux-kernel

Make sense,
I send a v2, thank's

2015-07-08 22:01 UTC+02:00, Darrick J. Wong <darrick.wong@oracle.com>:
> On Wed, Jul 08, 2015 at 09:51:15PM +0200, Laurent Navet wrote:
>> Return value of ext4_derive_key_aes() is stored but never used before
>> being overwritten.
>> Also fix coverity CID 1309760.
>>
>> Signed-off-by: Laurent Navet <laurent.navet@gmail.com>
>> ---
>>  fs/ext4/crypto_key.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/ext4/crypto_key.c b/fs/ext4/crypto_key.c
>> index 442d24e..92f9172 100644
>> --- a/fs/ext4/crypto_key.c
>> +++ b/fs/ext4/crypto_key.c
>> @@ -218,7 +218,7 @@ retry:
>>  	BUILD_BUG_ON(EXT4_AES_128_ECB_KEY_SIZE !=
>>  		     EXT4_KEY_DERIVATION_NONCE_SIZE);
>>  	BUG_ON(master_key->size != EXT4_AES_256_XTS_KEY_SIZE);
>> -	res = ext4_derive_key_aes(ctx.nonce, master_key->raw,
>> +	ext4_derive_key_aes(ctx.nonce, master_key->raw,
>>  				  raw_key);
>
> I don't think it's a good idea to drop the error code on the floor and keep
> going as if nothing bad had happened.
>
> --D
>
>>  got_key:
>>  	ctfm = crypto_alloc_ablkcipher(cipher_str, 0, 0);
>> --
>> 2.1.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


-- 
« On ne résout pas un problème avec les modes de pensée qui l’ont engendré. »
« You cannot solve current problems with current thinking. Current
problems are the result of current thinking »

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-07-09 19:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-08 19:51 [PATCH] ext4 crypto: remove unneeded assignation Laurent Navet
2015-07-08 19:55 ` Joe Perches
2015-07-08 20:01 ` Darrick J. Wong
2015-07-09 19:04   ` Laurent Navet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox