Re: [PATCH] crypto: Fix test in get_prng_bytes()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 12, 2009 at 03:09:09PM +0200, Roel Kluin wrote:
> size_t nbytes cannot be less than 0.
> 
> Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
> ---
> Or should this test be removed?
> 
> diff --git a/crypto/ansi_cprng.c b/crypto/ansi_cprng.c
> index 3aa6e38..9162456 100644
> --- a/crypto/ansi_cprng.c
> +++ b/crypto/ansi_cprng.c
> @@ -192,7 +192,7 @@ static int get_prng_bytes(char *buf, size_t nbytes, struct prng_context *ctx)
>  	int err;
>  
>  
> -	if (nbytes < 0)
> +	if ((ssize_t)nbytes < 0)
>  		return -EINVAL;
>  
>  	spin_lock_bh(&ctx->prng_lock);
No, you're quite right, its a harmless, but unneeded check.  Herbert, could you
pull this into cryptodev please?  Thank you.

Thanks for the patch Roel.

Acked-by: Neil Horman <nhorman@xxxxxxxxxxxxx>

Neil

> --
> To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux