Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: jitter - Use min() to simplify jent_read_entropy()

Use the min() macro to simplify the jent_read_entropy() function and
improve its readability.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Thorsten Blum and committed by
Herbert Xu
7f60adff ce3d2d6b

+2 -4
+2 -4
crypto/jitterentropy.c
··· 146 146 #define JENT_ENTROPY_SAFETY_FACTOR 64 147 147 148 148 #include <linux/fips.h> 149 + #include <linux/minmax.h> 149 150 #include "jitterentropy.h" 150 151 151 152 /*************************************************************************** ··· 639 638 return -2; 640 639 } 641 640 642 - if ((DATA_SIZE_BITS / 8) < len) 643 - tocopy = (DATA_SIZE_BITS / 8); 644 - else 645 - tocopy = len; 641 + tocopy = min(DATA_SIZE_BITS / 8, len); 646 642 if (jent_read_random_block(ec->hash_state, p, tocopy)) 647 643 return -1; 648 644