linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] crypto: sun4i-ss: Fix 64-bit size_t warnings on sun4i-ss-hash.c
@ 2019-11-14 10:49 Corentin Labbe
  2019-11-14 10:49 ` [PATCH 2/2] crypto: sun4i-ss: remove dependency on not 64BIT Corentin Labbe
  2019-11-22 11:03 ` [PATCH 1/2] crypto: sun4i-ss: Fix 64-bit size_t warnings on sun4i-ss-hash.c Herbert Xu
  0 siblings, 2 replies; 4+ messages in thread
From: Corentin Labbe @ 2019-11-14 10:49 UTC (permalink / raw)
  To: davem, herbert, mripard, wens
  Cc: linux-sunxi, Corentin Labbe, linux-crypto, linux-arm-kernel,
	linux-kernel

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.montjoie@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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] crypto: sun4i-ss: remove dependency on not 64BIT
  2019-11-14 10:49 [PATCH 1/2] crypto: sun4i-ss: Fix 64-bit size_t warnings on sun4i-ss-hash.c Corentin Labbe
@ 2019-11-14 10:49 ` Corentin Labbe
       [not found]   ` <201911181510.4s0BW0Qc%lkp@intel.com>
  2019-11-22 11:03 ` [PATCH 1/2] crypto: sun4i-ss: Fix 64-bit size_t warnings on sun4i-ss-hash.c Herbert Xu
  1 sibling, 1 reply; 4+ messages in thread
From: Corentin Labbe @ 2019-11-14 10:49 UTC (permalink / raw)
  To: davem, herbert, mripard, wens
  Cc: linux-sunxi, Corentin Labbe, linux-crypto, linux-arm-kernel,
	linux-kernel

The driver now compile without warnings on 64bits, we can remove the
!64BIT condition.

Signed-off-by: Corentin Labbe <clabbe.montjoie@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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] crypto: sun4i-ss: remove dependency on not 64BIT
       [not found]   ` <201911181510.4s0BW0Qc%lkp@intel.com>
@ 2019-11-18 10:03     ` Corentin Labbe
  0 siblings, 0 replies; 4+ messages in thread
From: Corentin Labbe @ 2019-11-18 10:03 UTC (permalink / raw)
  To: kbuild test robot
  Cc: kbuild-all, herbert, linux-sunxi, linux-kernel, mripard, wens,
	linux-crypto, davem, linux-arm-kernel

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 <lkp@intel.com>
> 

Hello

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

Regards

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] crypto: sun4i-ss: Fix 64-bit size_t warnings on sun4i-ss-hash.c
  2019-11-14 10:49 [PATCH 1/2] crypto: sun4i-ss: Fix 64-bit size_t warnings on sun4i-ss-hash.c Corentin Labbe
  2019-11-14 10:49 ` [PATCH 2/2] crypto: sun4i-ss: remove dependency on not 64BIT Corentin Labbe
@ 2019-11-22 11:03 ` Herbert Xu
  1 sibling, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2019-11-22 11:03 UTC (permalink / raw)
  To: Corentin Labbe
  Cc: linux-sunxi, linux-kernel, mripard, wens, linux-crypto, davem,
	linux-arm-kernel

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.montjoie@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 <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-22 11:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-14 10:49 [PATCH 1/2] crypto: sun4i-ss: Fix 64-bit size_t warnings on sun4i-ss-hash.c Corentin Labbe
2019-11-14 10:49 ` [PATCH 2/2] crypto: sun4i-ss: remove dependency on not 64BIT Corentin Labbe
     [not found]   ` <201911181510.4s0BW0Qc%lkp@intel.com>
2019-11-18 10:03     ` Corentin Labbe
2019-11-22 11:03 ` [PATCH 1/2] crypto: sun4i-ss: Fix 64-bit size_t warnings on sun4i-ss-hash.c Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).