Skip to content

Commit f2e5373

Browse files
kerneltoastPlaidCat
authored andcommitted
crypto: rng - Convert crypto_default_rng_refcnt into an unsigned int
There is no reason this refcount should be a signed int. Convert it to an unsigned int, thereby also making it less likely to ever overflow. Signed-off-by: Sultan Alsawaf <sultan@ciq.com> Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 2dbc326 commit f2e5373

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crypto/rng.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static struct crypto_rng *crypto_reseed_rng;
3131
static ____cacheline_aligned_in_smp DEFINE_MUTEX(crypto_default_rng_lock);
3232
struct crypto_rng *crypto_default_rng;
3333
EXPORT_SYMBOL_GPL(crypto_default_rng);
34-
static int crypto_default_rng_refcnt;
34+
static unsigned int crypto_default_rng_refcnt;
3535

3636
int crypto_rng_reset(struct crypto_rng *tfm, const u8 *seed, unsigned int slen)
3737
{
@@ -164,7 +164,7 @@ void crypto_put_default_rng(void)
164164
EXPORT_SYMBOL_GPL(crypto_put_default_rng);
165165

166166
#if defined(CONFIG_CRYPTO_RNG) || defined(CONFIG_CRYPTO_RNG_MODULE)
167-
static int crypto_del_rng(struct crypto_rng **rngp, int *refcntp,
167+
static int crypto_del_rng(struct crypto_rng **rngp, unsigned int *refcntp,
168168
struct mutex *lock)
169169
{
170170
int err = -EBUSY;

0 commit comments

Comments
 (0)