Commit 652d5b8a authored by LABBE Corentin's avatar LABBE Corentin Committed by Herbert Xu

crypto: algif - Change some variable to size_t

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: default avatarLABBE Corentin <clabbe.montjoie@gmail.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent c52b6733
...@@ -213,7 +213,7 @@ static int aead_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) ...@@ -213,7 +213,7 @@ static int aead_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
} }
while (size) { while (size) {
unsigned long len = size; size_t len = size;
struct scatterlist *sg = NULL; struct scatterlist *sg = NULL;
/* use the existing memory in an allocated page */ /* 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) ...@@ -247,7 +247,7 @@ static int aead_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
/* allocate a new page */ /* allocate a new page */
len = min_t(unsigned long, size, aead_sndbuf(sk)); len = min_t(unsigned long, size, aead_sndbuf(sk));
while (len) { while (len) {
int plen = 0; size_t plen = 0;
if (sgl->cur >= ALG_MAX_PAGES) { if (sgl->cur >= ALG_MAX_PAGES) {
aead_put_sgl(sk); aead_put_sgl(sk);
...@@ -256,7 +256,7 @@ static int aead_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) ...@@ -256,7 +256,7 @@ static int aead_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
} }
sg = sgl->sg + sgl->cur; 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)); sg_assign_page(sg, alloc_page(GFP_KERNEL));
err = -ENOMEM; err = -ENOMEM;
......
...@@ -40,7 +40,7 @@ struct skcipher_ctx { ...@@ -40,7 +40,7 @@ struct skcipher_ctx {
struct af_alg_completion completion; struct af_alg_completion completion;
atomic_t inflight; atomic_t inflight;
unsigned used; size_t used;
unsigned int len; unsigned int len;
bool more; bool more;
...@@ -153,7 +153,7 @@ static int skcipher_alloc_sgl(struct sock *sk) ...@@ -153,7 +153,7 @@ static int skcipher_alloc_sgl(struct sock *sk)
return 0; 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 alg_sock *ask = alg_sk(sk);
struct skcipher_ctx *ctx = ask->private; struct skcipher_ctx *ctx = ask->private;
...@@ -167,7 +167,7 @@ static void skcipher_pull_sgl(struct sock *sk, int used, int put) ...@@ -167,7 +167,7 @@ static void skcipher_pull_sgl(struct sock *sk, int used, int put)
sg = sgl->sg; sg = sgl->sg;
for (i = 0; i < sgl->cur; i++) { 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)) if (!sg_page(sg + i))
continue; continue;
...@@ -348,7 +348,7 @@ static int skcipher_sendmsg(struct socket *sock, struct msghdr *msg, ...@@ -348,7 +348,7 @@ static int skcipher_sendmsg(struct socket *sock, struct msghdr *msg,
while (size) { while (size) {
struct scatterlist *sg; struct scatterlist *sg;
unsigned long len = size; unsigned long len = size;
int plen; size_t plen;
if (ctx->merge) { if (ctx->merge) {
sgl = list_entry(ctx->tsgl.prev, sgl = list_entry(ctx->tsgl.prev,
...@@ -390,7 +390,7 @@ static int skcipher_sendmsg(struct socket *sock, struct msghdr *msg, ...@@ -390,7 +390,7 @@ static int skcipher_sendmsg(struct socket *sock, struct msghdr *msg,
sg_unmark_end(sg + sgl->cur); sg_unmark_end(sg + sgl->cur);
do { do {
i = sgl->cur; 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)); sg_assign_page(sg + i, alloc_page(GFP_KERNEL));
err = -ENOMEM; err = -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment