From patchwork Fri Oct 23 12:10:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 7472531 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C22659F1C3 for ; Fri, 23 Oct 2015 12:12:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D6B4420688 for ; Fri, 23 Oct 2015 12:12:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ED9B120678 for ; Fri, 23 Oct 2015 12:12:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753469AbbJWMMC (ORCPT ); Fri, 23 Oct 2015 08:12:02 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:37247 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752095AbbJWMLq (ORCPT ); Fri, 23 Oct 2015 08:11:46 -0400 Received: by wicfv8 with SMTP id fv8so29102440wic.0; Fri, 23 Oct 2015 05:11:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=STw6J4p2Y1TxJP7e9/KETHDY6aKL3DTFKrC9taIcp9g=; b=vEC9Vqre8lXUI0/boPjK5wJ+H8xOTVXwoNWICCL0R3j0JhEuNWL573ndvgBA35A2qm Fq+ztq4bLv5Vt+1qF+JqsHIoOi/3QJXVBbk7HtvHLbApdwGD4S229D5fppHZZlfm/u8e TSxIn5etNQiX3YzKXRkNZnPXnm8WByMtOB7FKQINt9QwlERVquesmFV7hQ9VG4Pu6OXh rX218CUWuR8bvXymCw8B49/6SN7s1lewYTio98Rln2NMYa71F+PatST+ZwOtoH+qRShB 61BrVohfzsioYd7WQycr23AqXPfEofeg6sTS0MXX2wpA0WNXZ5zI2Ntwu4nUzZkwdZmp CmTg== X-Received: by 10.180.93.197 with SMTP id cw5mr4415112wib.53.1445602305023; Fri, 23 Oct 2015 05:11:45 -0700 (PDT) Received: from Red.local (ANice-651-1-260-13.w86-205.abo.wanadoo.fr. [86.205.164.13]) by smtp.googlemail.com with ESMTPSA id o3sm2740629wif.22.2015.10.23.05.11.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 Oct 2015 05:11:44 -0700 (PDT) From: LABBE Corentin To: davem@davemloft.net, herbert@gondor.apana.org.au Cc: LABBE Corentin , 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 Message-Id: <1445602236-24130-12-git-send-email-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.4.10 In-Reply-To: <1445602236-24130-1-git-send-email-clabbe.montjoie@gmail.com> References: <1445602236-24130-1-git-send-email-clabbe.montjoie@gmail.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;