Linux cryptographic layer development
 help / color / mirror / Atom feed
* [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

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