2014-02-13 14:59:16

by Dan Carpenter

[permalink] [raw]
Subject: [patch] crypto: remove a duplicate checks in __cbc_decrypt()

We checked "nbytes < bsize" before so it can't happen here.

Signed-off-by: Dan Carpenter <[email protected]>
---
This doesn't change how the code works, but maybe their is a bug in the
original code. Please review?

diff --git a/arch/x86/crypto/cast5_avx_glue.c b/arch/x86/crypto/cast5_avx_glue.c
index e6a3700489b9..e57e20ab5e0b 100644
--- a/arch/x86/crypto/cast5_avx_glue.c
+++ b/arch/x86/crypto/cast5_avx_glue.c
@@ -203,9 +203,6 @@ static unsigned int __cbc_decrypt(struct blkcipher_desc *desc,
src -= 1;
dst -= 1;
} while (nbytes >= bsize * CAST5_PARALLEL_BLOCKS);
-
- if (nbytes < bsize)
- goto done;
}

/* Handle leftovers */
diff --git a/arch/x86/crypto/blowfish_glue.c b/arch/x86/crypto/blowfish_glue.c
index 50ec333b70e6..8af519ed73d1 100644
--- a/arch/x86/crypto/blowfish_glue.c
+++ b/arch/x86/crypto/blowfish_glue.c
@@ -223,9 +223,6 @@ static unsigned int __cbc_decrypt(struct blkcipher_desc *desc,
src -= 1;
dst -= 1;
} while (nbytes >= bsize * 4);
-
- if (nbytes < bsize)
- goto done;
}

/* Handle leftovers */


2014-02-14 17:44:50

by Jussi Kivilinna

[permalink] [raw]
Subject: Re: [patch] crypto: remove a duplicate checks in __cbc_decrypt()

On 13.02.2014 16:58, Dan Carpenter wrote:
> We checked "nbytes < bsize" before so it can't happen here.
>
> Signed-off-by: Dan Carpenter <[email protected]>

Acked-by: Jussi Kivilinna <[email protected]>

> ---
> This doesn't change how the code works, but maybe their is a bug in the
> original code. Please review?
>
> diff --git a/arch/x86/crypto/cast5_avx_glue.c b/arch/x86/crypto/cast5_avx_glue.c
> index e6a3700489b9..e57e20ab5e0b 100644
> --- a/arch/x86/crypto/cast5_avx_glue.c
> +++ b/arch/x86/crypto/cast5_avx_glue.c
> @@ -203,9 +203,6 @@ static unsigned int __cbc_decrypt(struct blkcipher_desc *desc,
> src -= 1;
> dst -= 1;
> } while (nbytes >= bsize * CAST5_PARALLEL_BLOCKS);
> -
> - if (nbytes < bsize)
> - goto done;
> }
>
> /* Handle leftovers */
> diff --git a/arch/x86/crypto/blowfish_glue.c b/arch/x86/crypto/blowfish_glue.c
> index 50ec333b70e6..8af519ed73d1 100644
> --- a/arch/x86/crypto/blowfish_glue.c
> +++ b/arch/x86/crypto/blowfish_glue.c
> @@ -223,9 +223,6 @@ static unsigned int __cbc_decrypt(struct blkcipher_desc *desc,
> src -= 1;
> dst -= 1;
> } while (nbytes >= bsize * 4);
> -
> - if (nbytes < bsize)
> - goto done;
> }
>
> /* Handle leftovers */
> --
> To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>

2014-02-14 17:55:45

by Johannes Götzfried

[permalink] [raw]
Subject: Re: [patch] crypto: remove a duplicate checks in __cbc_decrypt()

On Thu, Feb 13, 2014 at 05:58:32PM +0300, Dan Carpenter wrote:
> Signed-off-by: Dan Carpenter <[email protected]>

Acked-by: Johannes G?tzfried <[email protected]>

> ---
> This doesn't change how the code works, but maybe their is a bug in the
> original code. Please review?

> diff --git a/arch/x86/crypto/cast5_avx_glue.c b/arch/x86/crypto/cast5_avx_glue.c
> index e6a3700489b9..e57e20ab5e0b 100644
> --- a/arch/x86/crypto/cast5_avx_glue.c
> +++ b/arch/x86/crypto/cast5_avx_glue.c
> @@ -203,9 +203,6 @@ static unsigned int __cbc_decrypt(struct blkcipher_desc *desc,
> src -= 1;
> dst -= 1;
> } while (nbytes >= bsize * CAST5_PARALLEL_BLOCKS);
> -
> - if (nbytes < bsize)
> - goto done;
> }

> /* Handle leftovers */
> diff --git a/arch/x86/crypto/blowfish_glue.c b/arch/x86/crypto/blowfish_glue.c
> index 50ec333b70e6..8af519ed73d1 100644
> --- a/arch/x86/crypto/blowfish_glue.c
> +++ b/arch/x86/crypto/blowfish_glue.c
> @@ -223,9 +223,6 @@ static unsigned int __cbc_decrypt(struct blkcipher_desc *desc,
> src -= 1;
> dst -= 1;
> } while (nbytes >= bsize * 4);
> -
> - if (nbytes < bsize)
> - goto done;
> }

> /* Handle leftovers */

2014-02-25 12:18:00

by Herbert Xu

[permalink] [raw]
Subject: Re: [patch] crypto: remove a duplicate checks in __cbc_decrypt()

On Fri, Feb 14, 2014 at 06:55:45PM +0100, Johannes G?tzfried wrote:
> On Thu, Feb 13, 2014 at 05:58:32PM +0300, Dan Carpenter wrote:
> > Signed-off-by: Dan Carpenter <[email protected]>
>
> Acked-by: Johannes G?tzfried <[email protected]>

Patch applied. Thanks!
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt