Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6975567ybx; Mon, 11 Nov 2019 18:39:02 -0800 (PST) X-Google-Smtp-Source: APXvYqzjds5NO9wM4+OXck8q4JMaSCDd2tl7qJBkYn7x0kjQjhZ4dxkNoB77mmvQBTiV2lHC9Ba2 X-Received: by 2002:a17:906:e289:: with SMTP id gg9mr667885ejb.71.1573526342275; Mon, 11 Nov 2019 18:39:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573526342; cv=none; d=google.com; s=arc-20160816; b=luaMk3V1+CZ1T1ffzDMHDBkLBssKTxmcElZMpjaleGCHw4QPi0VNnu1zefwI0rC2Pa 0Lj/it1lUEy3xE2t2VcPHKRcnN55p6iYW6xiLd6Z0De1XQ3hRGM1zNo3a+j9HNHHZ7hh 9bQhUdEQodc0/IKdxowKKvA+2wqcWkWjexY6tCiiQv/U7osgNKdLyC9beA0ebJH2h+jY 0aceAbZPX4JGn6sYkz5wbxjyYIa2wQkkfnP3D4HRBbAujyg+ZzKOSi+WbfJuLkmeiskh XLzWw3gY7Av+7H+2JHviaFBpKi07fcZcffjxrDsHkMLjC/uXYGtjZjTR82k4m1Mis8el JJ2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:to:from:date; bh=TbJ55cnqi3goSiWblBk6Vatl/ypkvyJaOhHb/rNySWM=; b=ga3gz05j3Z9SMcj7xtp4hfUrrGer+3jce24g1K6dRkNFfphP27rNo5D0wGd0Ip78nK EO1p0PUyE0hQiZcl0mFZ9Ff1BtAkygmTpfsZzw1maYPIrCcThuAc0XdXpSK+tT4eXg0H I+laNebnYgYxZt/GRJiQ3Dva7op31VvU44HGotgXZu8SDjevkGrfBRj2mwWuzstFoqh5 6scncRcmvEnEsoBMp9jq3YiS2JzGQTgYoSboDcDXigfVGDF3DqwEnxkYNIxhlno7oyax HiBIsxHidOPMUYLOuF+zXf00MtmsU+N+nT1mmBLLw4nHH91JTZZdUruZsaXpFPlPcqjd sNZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s13si3601073ejx.144.2019.11.11.18.38.36; Mon, 11 Nov 2019 18:39:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726924AbfKLCif (ORCPT + 99 others); Mon, 11 Nov 2019 21:38:35 -0500 Received: from helcar.hmeau.com ([216.24.177.18]:36554 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726923AbfKLCif (ORCPT ); Mon, 11 Nov 2019 21:38:35 -0500 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtps (Exim 4.89 #2 (Debian)) id 1iUM4g-0007ml-F4; Tue, 12 Nov 2019 10:38:34 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1iUM4g-0007UA-An; Tue, 12 Nov 2019 10:38:34 +0800 Date: Tue, 12 Nov 2019 10:38:34 +0800 From: Herbert Xu To: Corentin Labbe , Linux Crypto Mailing List Subject: [PATCH] crypto: sun4i-ss - Fix 64-bit size_t warnings Message-ID: <20191112023834.l7mbyrlhhaxgpbdp@gondor.apana.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org If you try to compile this driver on a 64-bit platform then you will get warnings because it mixes size_t with unsigned int which only works on 32-bit. This patch fixes all of the warnings. Signed-off-by: Herbert Xu diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c index e5954a643daf..5ab919c17e78 100644 --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c @@ -72,7 +72,8 @@ static int noinline_for_stack sun4i_ss_opti_poll(struct skcipher_request *areq) oi = 0; oo = 0; do { - todo = min3(rx_cnt, ileft, (mi.length - oi) / 4); + todo = min(rx_cnt, ileft); + todo = min_t(size_t, todo, (mi.length - oi) / 4); if (todo) { ileft -= todo; writesl(ss->base + SS_RXFIFO, mi.addr + oi, todo); @@ -87,7 +88,8 @@ static int noinline_for_stack sun4i_ss_opti_poll(struct skcipher_request *areq) rx_cnt = SS_RXFIFO_SPACES(spaces); tx_cnt = SS_TXFIFO_SPACES(spaces); - todo = min3(tx_cnt, oleft, (mo.length - oo) / 4); + todo = min(tx_cnt, oleft); + todo = min_t(size_t, todo, (mo.length - oo) / 4); if (todo) { oleft -= todo; readsl(ss->base + SS_TXFIFO, mo.addr + oo, todo); @@ -239,7 +241,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) * todo is the number of consecutive 4byte word that we * can read from current SG */ - todo = min3(rx_cnt, ileft / 4, (mi.length - oi) / 4); + todo = min(rx_cnt, ileft / 4); + todo = min_t(size_t, todo, (mi.length - oi) / 4); if (todo && !ob) { writesl(ss->base + SS_RXFIFO, mi.addr + oi, todo); @@ -253,8 +256,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) * we need to be able to write all buf in one * pass, so it is why we min() with rx_cnt */ - todo = min3(rx_cnt * 4 - ob, ileft, - mi.length - oi); + todo = min(rx_cnt * 4 - ob, ileft); + todo = min_t(size_t, todo, mi.length - oi); memcpy(buf + ob, mi.addr + oi, todo); ileft -= todo; oi += todo; @@ -274,7 +277,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) spaces = readl(ss->base + SS_FCSR); rx_cnt = SS_RXFIFO_SPACES(spaces); tx_cnt = SS_TXFIFO_SPACES(spaces); - dev_dbg(ss->dev, "%x %u/%u %u/%u cnt=%u %u/%u %u/%u cnt=%u %u\n", + dev_dbg(ss->dev, + "%x %u/%zu %u/%u cnt=%u %u/%zu %u/%u cnt=%u %u\n", mode, oi, mi.length, ileft, areq->cryptlen, rx_cnt, oo, mo.length, oleft, areq->cryptlen, tx_cnt, ob); @@ -282,7 +286,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) if (!tx_cnt) continue; /* todo in 4bytes word */ - todo = min3(tx_cnt, oleft / 4, (mo.length - oo) / 4); + todo = min(tx_cnt, oleft / 4); + todo = min_t(size_t, todo, (mo.length - oo) / 4); if (todo) { readsl(ss->base + SS_TXFIFO, mo.addr + oo, todo); oleft -= todo * 4; @@ -308,7 +313,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) * no more than remaining buffer * no need to test against oleft */ - todo = min(mo.length - oo, obl - obo); + todo = min_t(size_t, + mo.length - oo, obl - obo); memcpy(mo.addr + oo, bufo + obo, todo); oleft -= todo; obo += todo; -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt