mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: LABBE Corentin <clabbe.montjoie@gmail.com>
To: davem@davemloft.net, herbert@gondor.apana.org.au
Cc: LABBE Corentin <clabbe.montjoie@gmail.com>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 11/11] crypto: algif: Change some variable to size_t
Date: Fri, 23 Oct 2015 14:10:36 +0200	[thread overview]
Message-ID: <1445602236-24130-12-git-send-email-clabbe.montjoie@gmail.com> (raw)
In-Reply-To: <1445602236-24130-1-git-send-email-clabbe.montjoie@gmail.com>

Some variable are set as int but store only positive values.
Furthermore there are used in operation/function that wait for unsigned
value.
This patch set them as size_t.

Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
 crypto/algif_aead.c     |  6 +++---
 crypto/algif_skcipher.c | 10 +++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c
index 0aa6fdf..f70bcf8 100644
--- a/crypto/algif_aead.c
+++ b/crypto/algif_aead.c
@@ -213,7 +213,7 @@ static int aead_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
 	}
 
 	while (size) {
-		unsigned long len = size;
+		size_t len = size;
 		struct scatterlist *sg = NULL;
 
 		/* use the existing memory in an allocated page */
@@ -247,7 +247,7 @@ static int aead_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
 		/* allocate a new page */
 		len = min_t(unsigned long, size, aead_sndbuf(sk));
 		while (len) {
-			int plen = 0;
+			size_t plen = 0;
 
 			if (sgl->cur >= ALG_MAX_PAGES) {
 				aead_put_sgl(sk);
@@ -256,7 +256,7 @@ static int aead_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
 			}
 
 			sg = sgl->sg + sgl->cur;
-			plen = min_t(int, len, PAGE_SIZE);
+			plen = min_t(size_t, len, PAGE_SIZE);
 
 			sg_assign_page(sg, alloc_page(GFP_KERNEL));
 			err = -ENOMEM;
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index af31a0e..bbb1b66 100644
--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -40,7 +40,7 @@ struct skcipher_ctx {
 	struct af_alg_completion completion;
 
 	atomic_t inflight;
-	unsigned used;
+	size_t used;
 
 	unsigned int len;
 	bool more;
@@ -153,7 +153,7 @@ static int skcipher_alloc_sgl(struct sock *sk)
 	return 0;
 }
 
-static void skcipher_pull_sgl(struct sock *sk, int used, int put)
+static void skcipher_pull_sgl(struct sock *sk, size_t used, int put)
 {
 	struct alg_sock *ask = alg_sk(sk);
 	struct skcipher_ctx *ctx = ask->private;
@@ -167,7 +167,7 @@ static void skcipher_pull_sgl(struct sock *sk, int used, int put)
 		sg = sgl->sg;
 
 		for (i = 0; i < sgl->cur; i++) {
-			int plen = min_t(int, used, sg[i].length);
+			size_t plen = min_t(size_t, used, sg[i].length);
 
 			if (!sg_page(sg + i))
 				continue;
@@ -348,7 +348,7 @@ static int skcipher_sendmsg(struct socket *sock, struct msghdr *msg,
 	while (size) {
 		struct scatterlist *sg;
 		unsigned long len = size;
-		int plen;
+		size_t plen;
 
 		if (ctx->merge) {
 			sgl = list_entry(ctx->tsgl.prev,
@@ -390,7 +390,7 @@ static int skcipher_sendmsg(struct socket *sock, struct msghdr *msg,
 		sg_unmark_end(sg + sgl->cur);
 		do {
 			i = sgl->cur;
-			plen = min_t(int, len, PAGE_SIZE);
+			plen = min_t(size_t, len, PAGE_SIZE);
 
 			sg_assign_page(sg + i, alloc_page(GFP_KERNEL));
 			err = -ENOMEM;
-- 
2.4.10


  parent reply	other threads:[~2015-10-23 12:12 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-23 12:10 LABBE Corentin
2015-10-23 12:10 ` [PATCH 01/11] net: change len parameter type for memcpy_[to|from]_msg LABBE Corentin
2015-10-23 12:10 ` [PATCH 02/11] net: llc: fix a setting of error value to size_t LABBE Corentin
2015-10-23 12:10 ` [PATCH 03/11] net: llc: change copied to size_t in llc_ui_sendmsg LABBE Corentin
2015-10-23 12:10 ` [PATCH 04/11] net: packet: change vnet_hdr_len from int to size_t LABBE Corentin
2015-10-23 13:35   ` Michael S. Tsirkin
2015-10-23 12:10 ` [PATCH 05/11] net: irda: change chunk " LABBE Corentin
2015-10-23 12:10 ` [PATCH 06/11] net: ipv6: set the length parameter of rawv6_send_hdrinc() " LABBE Corentin
2015-10-23 12:10 ` [PATCH 07/11] net: caif: change chunk from int " LABBE Corentin
2015-10-23 12:10 ` [PATCH 08/11] net: bluetooth: change the len parameter of sco_send_frame() " LABBE Corentin
2015-10-23 12:30   ` kbuild test robot
2015-10-23 12:36   ` kbuild test robot
2015-10-23 12:40   ` kbuild test robot
2015-10-25 19:54   ` Marcel Holtmann
2015-10-23 12:10 ` [PATCH 09/11] net: ipv6: hlen could be set as size_t LABBE Corentin
2015-10-23 12:33   ` kbuild test robot
2015-10-23 12:46   ` kbuild test robot
2015-10-23 12:10 ` [PATCH 10/11] net: ipv4: " LABBE Corentin
2015-10-23 12:43   ` kbuild test robot
2015-10-23 13:08   ` David Miller
2015-10-23 13:21     ` LABBE Corentin
2015-10-23 13:51       ` David Miller
2015-10-23 12:10 ` LABBE Corentin [this message]
2015-11-17 14:08   ` [PATCH 11/11] crypto: algif: Change some variable to size_t Herbert Xu

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=1445602236-24130-12-git-send-email-clabbe.montjoie@gmail.com \
    --to=clabbe.montjoie@gmail.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®