* [PATCH] crypto: Fix test in get_prng_bytes() @ 2009-10-12 13:09 Roel Kluin 2009-10-12 13:51 ` Neil Horman 0 siblings, 1 reply; 7+ messages in thread From: Roel Kluin @ 2009-10-12 13:09 UTC (permalink / raw) To: Herbert Xu, David S. Miller, linux-crypto, Andrew Morton size_t nbytes cannot be less than 0. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> --- 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); ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] crypto: Fix test in get_prng_bytes() 2009-10-12 13:09 [PATCH] crypto: Fix test in get_prng_bytes() Roel Kluin @ 2009-10-12 13:51 ` Neil Horman 2009-10-12 14:07 ` Herbert Xu 0 siblings, 1 reply; 7+ messages in thread From: Neil Horman @ 2009-10-12 13:51 UTC (permalink / raw) To: Roel Kluin; +Cc: Herbert Xu, David S. Miller, linux-crypto, Andrew Morton 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@gmail.com> > --- > 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@tuxdriver.com> Neil > -- > To unsubscribe from this list: send the line "unsubscribe linux-crypto" 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] 7+ messages in thread
* Re: [PATCH] crypto: Fix test in get_prng_bytes() 2009-10-12 13:51 ` Neil Horman @ 2009-10-12 14:07 ` Herbert Xu 2009-10-12 14:22 ` Roel Kluin 2009-10-12 14:28 ` Neil Horman 0 siblings, 2 replies; 7+ messages in thread From: Herbert Xu @ 2009-10-12 14:07 UTC (permalink / raw) To: Neil Horman; +Cc: Roel Kluin, David S. Miller, linux-crypto, Andrew Morton On Mon, Oct 12, 2009 at 09:51:42AM -0400, Neil Horman wrote: . > > 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. Hmm, if it's unneeded why don't we just kill it instead? Thanks, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] crypto: Fix test in get_prng_bytes() 2009-10-12 14:07 ` Herbert Xu @ 2009-10-12 14:22 ` Roel Kluin 2009-10-12 14:29 ` Neil Horman 2009-10-12 14:28 ` Neil Horman 1 sibling, 1 reply; 7+ messages in thread From: Roel Kluin @ 2009-10-12 14:22 UTC (permalink / raw) To: Herbert Xu; +Cc: Neil Horman, David S. Miller, linux-crypto, Andrew Morton Op 12-10-09 16:07, Herbert Xu schreef: > On Mon, Oct 12, 2009 at 09:51:42AM -0400, Neil Horman wrote: > . >>> 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. > > Hmm, if it's unneeded why don't we just kill it instead? In that case: -------------------------->8------------------8<------------------------- size_t nbytes cannot be less than 0 and the test was redundant. Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: Roel Kluin <roel.kluin@gmail.com> --- diff --git a/crypto/ansi_cprng.c b/crypto/ansi_cprng.c index 3aa6e38..47995ae 100644 --- a/crypto/ansi_cprng.c +++ b/crypto/ansi_cprng.c @@ -192,9 +192,6 @@ static int get_prng_bytes(char *buf, size_t nbytes, struct prng_context *ctx) int err; - if (nbytes < 0) - return -EINVAL; ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] crypto: Fix test in get_prng_bytes() 2009-10-12 14:22 ` Roel Kluin @ 2009-10-12 14:29 ` Neil Horman 2009-10-27 10:52 ` Herbert Xu 0 siblings, 1 reply; 7+ messages in thread From: Neil Horman @ 2009-10-12 14:29 UTC (permalink / raw) To: Roel Kluin; +Cc: Herbert Xu, David S. Miller, linux-crypto, Andrew Morton On Mon, Oct 12, 2009 at 04:22:05PM +0200, Roel Kluin wrote: > Op 12-10-09 16:07, Herbert Xu schreef: > > On Mon, Oct 12, 2009 at 09:51:42AM -0400, Neil Horman wrote: > > . > >>> 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. > > > > Hmm, if it's unneeded why don't we just kill it instead? > > In that case: > -------------------------->8------------------8<------------------------- > size_t nbytes cannot be less than 0 and the test was redundant. > > Acked-by: Neil Horman <nhorman@tuxdriver.com> > Signed-off-by: Roel Kluin <roel.kluin@gmail.com> > --- > diff --git a/crypto/ansi_cprng.c b/crypto/ansi_cprng.c > index 3aa6e38..47995ae 100644 > --- a/crypto/ansi_cprng.c > +++ b/crypto/ansi_cprng.c > @@ -192,9 +192,6 @@ static int get_prng_bytes(char *buf, size_t nbytes, struct prng_context *ctx) > int err; > > > - if (nbytes < 0) > - return -EINVAL; > - > spin_lock_bh(&ctx->prng_lock); > > err = -EINVAL; > There you go, yes :) Acked-by: Neil Horman <nhorman@tuxdriver.com> Neil ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] crypto: Fix test in get_prng_bytes() 2009-10-12 14:29 ` Neil Horman @ 2009-10-27 10:52 ` Herbert Xu 0 siblings, 0 replies; 7+ messages in thread From: Herbert Xu @ 2009-10-27 10:52 UTC (permalink / raw) To: Neil Horman; +Cc: Roel Kluin, David S. Miller, linux-crypto, Andrew Morton On Mon, Oct 12, 2009 at 10:29:08AM -0400, Neil Horman wrote: > > Acked-by: Neil Horman <nhorman@tuxdriver.com> Patch applied to cryptodev. Thanks! -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] crypto: Fix test in get_prng_bytes() 2009-10-12 14:07 ` Herbert Xu 2009-10-12 14:22 ` Roel Kluin @ 2009-10-12 14:28 ` Neil Horman 1 sibling, 0 replies; 7+ messages in thread From: Neil Horman @ 2009-10-12 14:28 UTC (permalink / raw) To: Herbert Xu; +Cc: Roel Kluin, David S. Miller, linux-crypto, Andrew Morton On Mon, Oct 12, 2009 at 11:07:53PM +0900, Herbert Xu wrote: > On Mon, Oct 12, 2009 at 09:51:42AM -0400, Neil Horman wrote: > . > > > 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. > > Hmm, if it's unneeded why don't we just kill it instead? > Sorry, thats what I mean't to say. Can you kill it, or do you want a patch for it? Neil > Thanks, > -- > Visit Openswan at http://www.openswan.org/ > Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au> > Home Page: http://gondor.apana.org.au/~herbert/ > PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt > ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-10-27 10:52 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-10-12 13:09 [PATCH] crypto: Fix test in get_prng_bytes() Roel Kluin 2009-10-12 13:51 ` Neil Horman 2009-10-12 14:07 ` Herbert Xu 2009-10-12 14:22 ` Roel Kluin 2009-10-12 14:29 ` Neil Horman 2009-10-27 10:52 ` Herbert Xu 2009-10-12 14:28 ` Neil Horman
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox