From: Roel Kluin <roel.kluin@gmail.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
linux-crypto@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] crypto: Fix test in get_prng_bytes()
Date: Mon, 12 Oct 2009 15:09:09 +0200 [thread overview]
Message-ID: <4AD32A75.5030706@gmail.com> (raw)
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);
next reply other threads:[~2009-10-12 13:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-12 13:09 Roel Kluin [this message]
2009-10-12 13:51 ` [PATCH] crypto: Fix test in get_prng_bytes() 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AD32A75.5030706@gmail.com \
--to=roel.kluin@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox