* [PATCH] crypto: jitterentropy: Put constants on the right side of the expression
@ 2021-03-17 1:44 Milan Djurovic
2021-03-18 14:16 ` Stephan Mueller
2021-03-26 9:31 ` Herbert Xu
0 siblings, 2 replies; 3+ messages in thread
From: Milan Djurovic @ 2021-03-17 1:44 UTC (permalink / raw)
To: herbert; +Cc: linux-crypto, Milan Djurovic
This patch fixes the following checkpatch.pl warnings:
crypto/jitterentropy.c:600: WARNING: Comparisons should place the constant on the right side of the test
crypto/jitterentropy.c:681: WARNING: Comparisons should place the constant on the right side of the test
crypto/jitterentropy.c:772: WARNING: Comparisons should place the constant on the right side of the test
crypto/jitterentropy.c:829: WARNING: Comparisons should place the constant on the right side of the test
Signed-off-by: Milan Djurovic <mdjurovic@zohomail.com>
---
crypto/jitterentropy.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/crypto/jitterentropy.c b/crypto/jitterentropy.c
index 6e147c43fc18..a11b3208760f 100644
--- a/crypto/jitterentropy.c
+++ b/crypto/jitterentropy.c
@@ -597,7 +597,7 @@ int jent_read_entropy(struct rand_data *ec, unsigned char *data,
if (!ec)
return -1;
- while (0 < len) {
+ while (len > 0) {
unsigned int tocopy;
jent_gen_entropy(ec);
@@ -678,7 +678,7 @@ struct rand_data *jent_entropy_collector_alloc(unsigned int osr,
}
/* verify and set the oversampling rate */
- if (0 == osr)
+ if (osr == 0)
osr = 1; /* minimum sampling rate is 1 */
entropy_collector->osr = osr;
@@ -769,7 +769,7 @@ int jent_entropy_init(void)
* etc. with the goal to clear it to get the worst case
* measurements.
*/
- if (CLEARCACHE > i)
+ if (i < CLEARCACHE)
continue;
if (stuck)
@@ -826,7 +826,7 @@ int jent_entropy_init(void)
* should not fail. The value of 3 should cover the NTP case being
* performed during our test run.
*/
- if (3 < time_backwards)
+ if (time_backwards > 3)
return JENT_ENOMONOTONIC;
/*
--
2.30.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: jitterentropy: Put constants on the right side of the expression
2021-03-17 1:44 [PATCH] crypto: jitterentropy: Put constants on the right side of the expression Milan Djurovic
@ 2021-03-18 14:16 ` Stephan Mueller
2021-03-26 9:31 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Stephan Mueller @ 2021-03-18 14:16 UTC (permalink / raw)
To: Milan Djurovic, herbert; +Cc: linux-crypto
Am Dienstag, dem 16.03.2021 um 18:44 -0700 schrieb Milan Djurovic:
> This patch fixes the following checkpatch.pl warnings:
>
> crypto/jitterentropy.c:600: WARNING: Comparisons should place the constant
> on the right side of the test
> crypto/jitterentropy.c:681: WARNING: Comparisons should place the constant
> on the right side of the test
> crypto/jitterentropy.c:772: WARNING: Comparisons should place the constant
> on the right side of the test
> crypto/jitterentropy.c:829: WARNING: Comparisons should place the constant
> on the right side of the test
>
> Signed-off-by: Milan Djurovic <mdjurovic@zohomail.com>
Thank you
Reviewed-by: Stephan Mueller <smueller@chronox.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: jitterentropy: Put constants on the right side of the expression
2021-03-17 1:44 [PATCH] crypto: jitterentropy: Put constants on the right side of the expression Milan Djurovic
2021-03-18 14:16 ` Stephan Mueller
@ 2021-03-26 9:31 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2021-03-26 9:31 UTC (permalink / raw)
To: Milan Djurovic; +Cc: linux-crypto
On Tue, Mar 16, 2021 at 06:44:03PM -0700, Milan Djurovic wrote:
> This patch fixes the following checkpatch.pl warnings:
>
> crypto/jitterentropy.c:600: WARNING: Comparisons should place the constant on the right side of the test
> crypto/jitterentropy.c:681: WARNING: Comparisons should place the constant on the right side of the test
> crypto/jitterentropy.c:772: WARNING: Comparisons should place the constant on the right side of the test
> crypto/jitterentropy.c:829: WARNING: Comparisons should place the constant on the right side of the test
>
> Signed-off-by: Milan Djurovic <mdjurovic@zohomail.com>
> ---
> crypto/jitterentropy.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <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] 3+ messages in thread
end of thread, other threads:[~2021-03-26 9:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-17 1:44 [PATCH] crypto: jitterentropy: Put constants on the right side of the expression Milan Djurovic
2021-03-18 14:16 ` Stephan Mueller
2021-03-26 9:31 ` Herbert Xu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.