Skip to contentSkip to conversation

crypto: bool type cosmetics

PATCH In review Lothar Rubusch 2 participants 2 messages Mar 20, 2020 – Mar 27, 2020 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 crypto: bool type cosmetics

When working with bool values the true and false definitions should be used instead of 1 and 0.

Hopefully I fixed my mailer and apologize for that.

---
 crypto/af_alg.c     | 10 +++++-----
 crypto/algif_hash.c |  6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)
crypto/af_alg.c +5 -5
index 439367a8e95c..b1cd3535c525 100644
@@ -821,8 +821,8 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size,
 	struct af_alg_tsgl *sgl;
 	struct af_alg_control con = {};
 	long copied = 0;
-	bool enc = 0;
-	bool init = 0;
+	bool enc = false;
+	bool init = false;
 	int err = 0;
 
 	if (msg->msg_controllen) {
@@ -830,13 +830,13 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size,
 		if (err)
 			return err;
 
-		init = 1;
+		init = true;
 		switch (con.op) {
 		case ALG_OP_ENCRYPT:
-			enc = 1;
+			enc = true;
 			break;
 		case ALG_OP_DECRYPT:
-			enc = 0;
+			enc = false;
 			break;
 		default:
 			return -EINVAL;
crypto/algif_hash.c +3 -3
index 178f4cd75ef1..da1ffa4f7f8d 100644
@@ -83,7 +83,7 @@ static int hash_sendmsg(struct socket *sock, struct msghdr *msg,
 			goto unlock;
 	}
 
-	ctx->more = 0;
+	ctx->more = false;
 
 	while (msg_data_left(msg)) {
 		int len = msg_data_left(msg);
@@ -211,7 +211,7 @@ static int hash_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
 	}
 
 	if (!result || ctx->more) {
-		ctx->more = 0;
+		ctx->more = false;
 		err = crypto_wait_req(crypto_ahash_final(&ctx->req),
 				      &ctx->wait);
 		if (err)
@@ -436,7 +436,7 @@ static int hash_accept_parent_nokey(void *private, struct sock *sk)
 
 	ctx->result = NULL;
 	ctx->len = len;
-	ctx->more = 0;
+	ctx->more = false;
 	crypto_init_wait(&ctx->wait);
 
 	ask->private = ctx;
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 10 lines · Lothar Rubusch

When working with bool values the true and false definitions should be used instead of 1 and 0.

Hopefully I fixed my mailer and apologize for that.

---
 crypto/af_alg.c     | 10 +++++-----
 crypto/algif_hash.c |  6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt