[PATCH 1/2] crypto: sun4i-ss: Fix 64-bit size_t warnings on sun4i-ss-hash.c

23 views
Skip to first unread message

Corentin Labbe

unread,
Nov 14, 2019, 5:49:26 AM11/14/19
to da...@davemloft.net, her...@gondor.apana.org.au, mri...@kernel.org, we...@csie.org, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, linux-...@vger.kernel.org, linux...@googlegroups.com, Corentin Labbe
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 on sun4i-ss-hash.c.
Signed-off-by: Corentin Labbe <clabbe....@gmail.com>
---
drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c
index 9930c9ce8971..91cf58db3845 100644
--- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c
+++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c
@@ -284,8 +284,8 @@ static int sun4i_hash(struct ahash_request *areq)
*/
while (op->len < 64 && i < end) {
/* how many bytes we can read from current SG */
- in_r = min3(mi.length - in_i, end - i,
- 64 - op->len);
+ in_r = min(end - i, 64 - op->len);
+ in_r = min_t(size_t, mi.length - in_i, in_r);
memcpy(op->buf + op->len, mi.addr + in_i, in_r);
op->len += in_r;
i += in_r;
@@ -305,8 +305,8 @@ static int sun4i_hash(struct ahash_request *areq)
}
if (mi.length - in_i > 3 && i < end) {
/* how many bytes we can read from current SG */
- in_r = min3(mi.length - in_i, areq->nbytes - i,
- ((mi.length - in_i) / 4) * 4);
+ in_r = min_t(size_t, mi.length - in_i, areq->nbytes - i);
+ in_r = min_t(size_t, ((mi.length - in_i) / 4) * 4, in_r);
/* how many bytes we can write in the device*/
todo = min3((u32)(end - i) / 4, rx_cnt, (u32)in_r / 4);
writesl(ss->base + SS_RXFIFO, mi.addr + in_i, todo);
@@ -332,8 +332,8 @@ static int sun4i_hash(struct ahash_request *areq)
if ((areq->nbytes - i) < 64) {
while (i < areq->nbytes && in_i < mi.length && op->len < 64) {
/* how many bytes we can read from current SG */
- in_r = min3(mi.length - in_i, areq->nbytes - i,
- 64 - op->len);
+ in_r = min(areq->nbytes - i, 64 - op->len);
+ in_r = min_t(size_t, mi.length - in_i, in_r);
memcpy(op->buf + op->len, mi.addr + in_i, in_r);
op->len += in_r;
i += in_r;
--
2.23.0

Corentin Labbe

unread,
Nov 14, 2019, 5:49:26 AM11/14/19
to da...@davemloft.net, her...@gondor.apana.org.au, mri...@kernel.org, we...@csie.org, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, linux-...@vger.kernel.org, linux...@googlegroups.com, Corentin Labbe
The driver now compile without warnings on 64bits, we can remove the
!64BIT condition.

Signed-off-by: Corentin Labbe <clabbe....@gmail.com>
---
drivers/crypto/allwinner/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/allwinner/Kconfig b/drivers/crypto/allwinner/Kconfig
index b3c9c34a30de..b0a5a0827483 100644
--- a/drivers/crypto/allwinner/Kconfig
+++ b/drivers/crypto/allwinner/Kconfig
@@ -7,7 +7,7 @@ config CRYPTO_DEV_ALLWINNER

config CRYPTO_DEV_SUN4I_SS
tristate "Support for Allwinner Security System cryptographic accelerator"
- depends on ARCH_SUNXI && !64BIT
+ depends on ARCH_SUNXI
depends on PM
depends on CRYPTO_DEV_ALLWINNER
select CRYPTO_MD5
--
2.23.0

Corentin Labbe

unread,
Nov 18, 2019, 5:04:03 AM11/18/19
to kbuild test robot, kbuil...@lists.01.org, da...@davemloft.net, her...@gondor.apana.org.au, mri...@kernel.org, we...@csie.org, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, linux-...@vger.kernel.org, linux...@googlegroups.com
On Mon, Nov 18, 2019 at 03:12:14PM +0800, kbuild test robot wrote:
> Hi Corentin,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on cryptodev/master]
> [also build test WARNING on next-20191115]
> [cannot apply to v5.4-rc8]
> [if your patch is applied to the wrong git tree, please drop us a note to help
> improve the system. BTW, we also suggest to use '--base' option to specify the
> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
>
> url: https://github.com/0day-ci/linux/commits/Corentin-Labbe/crypto-sun4i-ss-Fix-64-bit-size_t-warnings-on-sun4i-ss-hash-c/20191114-211327
> base: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
> config: arm64-allyesconfig (attached as .config)
> compiler: aarch64-linux-gcc (GCC) 7.4.0
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> GCC_VERSION=7.4.0 make.cross ARCH=arm64
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <l...@intel.com>
>

Hello

Thoses warning are handle by the "[PATCH] crypto: sun4i-ss - Fix 64-bit size_t warnings" from Herbert.

Regards

Herbert Xu

unread,
Nov 22, 2019, 6:03:57 AM11/22/19
to Corentin Labbe, da...@davemloft.net, mri...@kernel.org, we...@csie.org, linux-ar...@lists.infradead.org, linux-...@vger.kernel.org, linux-...@vger.kernel.org, linux...@googlegroups.com
On Thu, Nov 14, 2019 at 11:49:06AM +0100, Corentin Labbe wrote:
> 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 on sun4i-ss-hash.c.
> Signed-off-by: Corentin Labbe <clabbe....@gmail.com>
> ---
> drivers/crypto/allwinner/sun4i-ss/sun4i-ss-hash.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)

All applied. Thanks.
--
Email: Herbert Xu <her...@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Reply all
Reply to author
Forward
0 new messages