linux-crypto.vger.kernel.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; 5+ messages in thread
From: Corentin Labbe @ 2019-11-14 10:49 UTC (permalink / raw)
  To: davem, herbert, mripard, wens
  Cc: linux-arm-kernel, linux-crypto, linux-kernel, linux-sunxi,
	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.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


^ permalink raw reply related	[flat|nested] 5+ 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
  2019-11-18  7:12   ` kbuild test robot
  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; 5+ messages in thread
From: Corentin Labbe @ 2019-11-14 10:49 UTC (permalink / raw)
  To: davem, herbert, mripard, wens
  Cc: linux-arm-kernel, linux-crypto, linux-kernel, linux-sunxi,
	Corentin Labbe

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


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

* Re: [PATCH 2/2] crypto: sun4i-ss: remove dependency on not 64BIT
  2019-11-14 10:49 ` [PATCH 2/2] crypto: sun4i-ss: remove dependency on not 64BIT Corentin Labbe
@ 2019-11-18  7:12   ` kbuild test robot
  2019-11-18 10:03     ` Corentin Labbe
  0 siblings, 1 reply; 5+ messages in thread
From: kbuild test robot @ 2019-11-18  7:12 UTC (permalink / raw)
  To: Corentin Labbe
  Cc: kbuild-all, davem, herbert, mripard, wens, linux-arm-kernel,
	linux-crypto, linux-kernel, linux-sunxi, Corentin Labbe

[-- Attachment #1: Type: text/plain, Size: 24346 bytes --]

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>

All warnings (new ones prefixed by >>):

   In file included from include/linux/clk.h:13:0,
                    from drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h:14,
                    from drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c:13:
   drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c: In function 'sun4i_ss_opti_poll':
   include/linux/kernel.h:842:29: warning: comparison of distinct pointer types lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   include/linux/kernel.h:856:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^~~~~~~~~~~
   include/linux/kernel.h:866:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:875:19: note: in expansion of macro '__careful_cmp'
    #define min(x, y) __careful_cmp(x, y, <)
                      ^~~~~~~~~~~~~
>> include/linux/kernel.h:890:23: note: in expansion of macro 'min'
    #define min3(x, y, z) min((typeof(x))min(x, y), z)
                          ^~~
>> drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c:75:10: note: in expansion of macro 'min3'
      todo = min3(rx_cnt, ileft, (mi.length - oi) / 4);
             ^~~~
   include/linux/kernel.h:842:29: warning: comparison of distinct pointer types lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   include/linux/kernel.h:856:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^~~~~~~~~~~
   include/linux/kernel.h:866:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:875:19: note: in expansion of macro '__careful_cmp'
    #define min(x, y) __careful_cmp(x, y, <)
                      ^~~~~~~~~~~~~
>> include/linux/kernel.h:890:23: note: in expansion of macro 'min'
    #define min3(x, y, z) min((typeof(x))min(x, y), z)
                          ^~~
   drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c:90:10: note: in expansion of macro 'min3'
      todo = min3(tx_cnt, oleft, (mo.length - oo) / 4);
             ^~~~
   drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c: In function 'sun4i_ss_cipher_poll':
   include/linux/kernel.h:842:29: warning: comparison of distinct pointer types lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   include/linux/kernel.h:856:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^~~~~~~~~~~
   include/linux/kernel.h:866:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:875:19: note: in expansion of macro '__careful_cmp'
    #define min(x, y) __careful_cmp(x, y, <)
                      ^~~~~~~~~~~~~
>> include/linux/kernel.h:890:23: note: in expansion of macro 'min'
    #define min3(x, y, z) min((typeof(x))min(x, y), z)
                          ^~~
   drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c:242:11: note: in expansion of macro 'min3'
       todo = min3(rx_cnt, ileft / 4, (mi.length - oi) / 4);
              ^~~~
   include/linux/kernel.h:842:29: warning: comparison of distinct pointer types lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   include/linux/kernel.h:856:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^~~~~~~~~~~
   include/linux/kernel.h:866:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:875:19: note: in expansion of macro '__careful_cmp'
    #define min(x, y) __careful_cmp(x, y, <)
                      ^~~~~~~~~~~~~
>> include/linux/kernel.h:890:23: note: in expansion of macro 'min'
    #define min3(x, y, z) min((typeof(x))min(x, y), z)
                          ^~~
   drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c:256:12: note: in expansion of macro 'min3'
        todo = min3(rx_cnt * 4 - ob, ileft,
               ^~~~
   In file included from include/linux/printk.h:332:0,
                    from include/linux/kernel.h:15,
                    from include/linux/clk.h:13,
                    from drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h:14,
                    from drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c:13:
>> drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c:277:20: warning: format '%u' expects argument of type 'unsigned int', but argument 6 has type 'size_t {aka long unsigned int}' [-Wformat=]
      dev_dbg(ss->dev, "%x %u/%u %u/%u cnt=%u %u/%u %u/%u cnt=%u %u\n",
                       ^
   include/linux/dynamic_debug.h:125:15: note: in definition of macro '__dynamic_func_call'
      func(&id, ##__VA_ARGS__);  \
                  ^~~~~~~~~~~
   include/linux/dynamic_debug.h:157:2: note: in expansion of macro '_dynamic_func_call'
     _dynamic_func_call(fmt,__dynamic_dev_dbg,   \
     ^~~~~~~~~~~~~~~~~~
   include/linux/device.h:1751:2: note: in expansion of macro 'dynamic_dev_dbg'
     dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~
   include/linux/device.h:1751:23: note: in expansion of macro 'dev_fmt'
     dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
                          ^~~~~~~
>> drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c:277:3: note: in expansion of macro 'dev_dbg'
      dev_dbg(ss->dev, "%x %u/%u %u/%u cnt=%u %u/%u %u/%u cnt=%u %u\n",
      ^~~~~~~
   drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c:277:20: warning: format '%u' expects argument of type 'unsigned int', but argument 11 has type 'size_t {aka long unsigned int}' [-Wformat=]
      dev_dbg(ss->dev, "%x %u/%u %u/%u cnt=%u %u/%u %u/%u cnt=%u %u\n",
                       ^
   include/linux/dynamic_debug.h:125:15: note: in definition of macro '__dynamic_func_call'
      func(&id, ##__VA_ARGS__);  \
                  ^~~~~~~~~~~
   include/linux/dynamic_debug.h:157:2: note: in expansion of macro '_dynamic_func_call'
     _dynamic_func_call(fmt,__dynamic_dev_dbg,   \
     ^~~~~~~~~~~~~~~~~~
   include/linux/device.h:1751:2: note: in expansion of macro 'dynamic_dev_dbg'
     dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~
   include/linux/device.h:1751:23: note: in expansion of macro 'dev_fmt'
     dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
                          ^~~~~~~
>> drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c:277:3: note: in expansion of macro 'dev_dbg'
      dev_dbg(ss->dev, "%x %u/%u %u/%u cnt=%u %u/%u %u/%u cnt=%u %u\n",
      ^~~~~~~
   In file included from include/linux/clk.h:13:0,
                    from drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h:14,
                    from drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c:13:
   include/linux/kernel.h:842:29: warning: comparison of distinct pointer types lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   include/linux/kernel.h:856:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^~~~~~~~~~~
   include/linux/kernel.h:866:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:875:19: note: in expansion of macro '__careful_cmp'
    #define min(x, y) __careful_cmp(x, y, <)
                      ^~~~~~~~~~~~~
>> include/linux/kernel.h:890:23: note: in expansion of macro 'min'
    #define min3(x, y, z) min((typeof(x))min(x, y), z)
                          ^~~
   drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c:285:10: note: in expansion of macro 'min3'
      todo = min3(tx_cnt, oleft / 4, (mo.length - oo) / 4);
             ^~~~
   include/linux/kernel.h:842:29: warning: comparison of distinct pointer types lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   include/linux/kernel.h:856:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^~~~~~~~~~~
   include/linux/kernel.h:866:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:875:19: note: in expansion of macro '__careful_cmp'
    #define min(x, y) __careful_cmp(x, y, <)
                      ^~~~~~~~~~~~~
>> drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c:311:12: note: in expansion of macro 'min'
        todo = min(mo.length - oo, obl - obo);
               ^~~
--
   In file included from include/linux/clk.h:13:0,
                    from drivers/crypto//allwinner/sun4i-ss/sun4i-ss.h:14,
                    from drivers/crypto//allwinner/sun4i-ss/sun4i-ss-cipher.c:13:
   drivers/crypto//allwinner/sun4i-ss/sun4i-ss-cipher.c: In function 'sun4i_ss_opti_poll':
   include/linux/kernel.h:842:29: warning: comparison of distinct pointer types lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   include/linux/kernel.h:856:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^~~~~~~~~~~
   include/linux/kernel.h:866:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:875:19: note: in expansion of macro '__careful_cmp'
    #define min(x, y) __careful_cmp(x, y, <)
                      ^~~~~~~~~~~~~
>> include/linux/kernel.h:890:23: note: in expansion of macro 'min'
    #define min3(x, y, z) min((typeof(x))min(x, y), z)
                          ^~~
   drivers/crypto//allwinner/sun4i-ss/sun4i-ss-cipher.c:75:10: note: in expansion of macro 'min3'
      todo = min3(rx_cnt, ileft, (mi.length - oi) / 4);
             ^~~~
   include/linux/kernel.h:842:29: warning: comparison of distinct pointer types lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   include/linux/kernel.h:856:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^~~~~~~~~~~
   include/linux/kernel.h:866:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:875:19: note: in expansion of macro '__careful_cmp'
    #define min(x, y) __careful_cmp(x, y, <)
                      ^~~~~~~~~~~~~
>> include/linux/kernel.h:890:23: note: in expansion of macro 'min'
    #define min3(x, y, z) min((typeof(x))min(x, y), z)
                          ^~~
   drivers/crypto//allwinner/sun4i-ss/sun4i-ss-cipher.c:90:10: note: in expansion of macro 'min3'
      todo = min3(tx_cnt, oleft, (mo.length - oo) / 4);
             ^~~~
   drivers/crypto//allwinner/sun4i-ss/sun4i-ss-cipher.c: In function 'sun4i_ss_cipher_poll':
   include/linux/kernel.h:842:29: warning: comparison of distinct pointer types lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   include/linux/kernel.h:856:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^~~~~~~~~~~
   include/linux/kernel.h:866:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:875:19: note: in expansion of macro '__careful_cmp'
    #define min(x, y) __careful_cmp(x, y, <)
                      ^~~~~~~~~~~~~
>> include/linux/kernel.h:890:23: note: in expansion of macro 'min'
    #define min3(x, y, z) min((typeof(x))min(x, y), z)
                          ^~~
   drivers/crypto//allwinner/sun4i-ss/sun4i-ss-cipher.c:242:11: note: in expansion of macro 'min3'
       todo = min3(rx_cnt, ileft / 4, (mi.length - oi) / 4);
              ^~~~
   include/linux/kernel.h:842:29: warning: comparison of distinct pointer types lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   include/linux/kernel.h:856:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^~~~~~~~~~~
   include/linux/kernel.h:866:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:875:19: note: in expansion of macro '__careful_cmp'
    #define min(x, y) __careful_cmp(x, y, <)
                      ^~~~~~~~~~~~~
>> include/linux/kernel.h:890:23: note: in expansion of macro 'min'
    #define min3(x, y, z) min((typeof(x))min(x, y), z)
                          ^~~
   drivers/crypto//allwinner/sun4i-ss/sun4i-ss-cipher.c:256:12: note: in expansion of macro 'min3'
        todo = min3(rx_cnt * 4 - ob, ileft,
               ^~~~
   In file included from include/linux/printk.h:332:0,
                    from include/linux/kernel.h:15,
                    from include/linux/clk.h:13,
                    from drivers/crypto//allwinner/sun4i-ss/sun4i-ss.h:14,
                    from drivers/crypto//allwinner/sun4i-ss/sun4i-ss-cipher.c:13:
   drivers/crypto//allwinner/sun4i-ss/sun4i-ss-cipher.c:277:20: warning: format '%u' expects argument of type 'unsigned int', but argument 6 has type 'size_t {aka long unsigned int}' [-Wformat=]
      dev_dbg(ss->dev, "%x %u/%u %u/%u cnt=%u %u/%u %u/%u cnt=%u %u\n",
                       ^
   include/linux/dynamic_debug.h:125:15: note: in definition of macro '__dynamic_func_call'
      func(&id, ##__VA_ARGS__);  \
                  ^~~~~~~~~~~
   include/linux/dynamic_debug.h:157:2: note: in expansion of macro '_dynamic_func_call'
     _dynamic_func_call(fmt,__dynamic_dev_dbg,   \
     ^~~~~~~~~~~~~~~~~~
   include/linux/device.h:1751:2: note: in expansion of macro 'dynamic_dev_dbg'
     dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~
   include/linux/device.h:1751:23: note: in expansion of macro 'dev_fmt'
     dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
                          ^~~~~~~
   drivers/crypto//allwinner/sun4i-ss/sun4i-ss-cipher.c:277:3: note: in expansion of macro 'dev_dbg'
      dev_dbg(ss->dev, "%x %u/%u %u/%u cnt=%u %u/%u %u/%u cnt=%u %u\n",
      ^~~~~~~
   drivers/crypto//allwinner/sun4i-ss/sun4i-ss-cipher.c:277:20: warning: format '%u' expects argument of type 'unsigned int', but argument 11 has type 'size_t {aka long unsigned int}' [-Wformat=]
      dev_dbg(ss->dev, "%x %u/%u %u/%u cnt=%u %u/%u %u/%u cnt=%u %u\n",
                       ^
   include/linux/dynamic_debug.h:125:15: note: in definition of macro '__dynamic_func_call'
      func(&id, ##__VA_ARGS__);  \
                  ^~~~~~~~~~~
   include/linux/dynamic_debug.h:157:2: note: in expansion of macro '_dynamic_func_call'
     _dynamic_func_call(fmt,__dynamic_dev_dbg,   \
     ^~~~~~~~~~~~~~~~~~
   include/linux/device.h:1751:2: note: in expansion of macro 'dynamic_dev_dbg'
     dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~
   include/linux/device.h:1751:23: note: in expansion of macro 'dev_fmt'
     dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
                          ^~~~~~~
   drivers/crypto//allwinner/sun4i-ss/sun4i-ss-cipher.c:277:3: note: in expansion of macro 'dev_dbg'
      dev_dbg(ss->dev, "%x %u/%u %u/%u cnt=%u %u/%u %u/%u cnt=%u %u\n",
      ^~~~~~~
   In file included from include/linux/clk.h:13:0,
                    from drivers/crypto//allwinner/sun4i-ss/sun4i-ss.h:14,
                    from drivers/crypto//allwinner/sun4i-ss/sun4i-ss-cipher.c:13:
   include/linux/kernel.h:842:29: warning: comparison of distinct pointer types lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   include/linux/kernel.h:856:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^~~~~~~~~~~
   include/linux/kernel.h:866:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:875:19: note: in expansion of macro '__careful_cmp'
    #define min(x, y) __careful_cmp(x, y, <)
                      ^~~~~~~~~~~~~
>> include/linux/kernel.h:890:23: note: in expansion of macro 'min'
    #define min3(x, y, z) min((typeof(x))min(x, y), z)
                          ^~~
   drivers/crypto//allwinner/sun4i-ss/sun4i-ss-cipher.c:285:10: note: in expansion of macro 'min3'
      todo = min3(tx_cnt, oleft / 4, (mo.length - oo) / 4);
             ^~~~
   include/linux/kernel.h:842:29: warning: comparison of distinct pointer types lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   include/linux/kernel.h:856:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^~~~~~~~~~~
   include/linux/kernel.h:866:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:875:19: note: in expansion of macro '__careful_cmp'
    #define min(x, y) __careful_cmp(x, y, <)
                      ^~~~~~~~~~~~~
   drivers/crypto//allwinner/sun4i-ss/sun4i-ss-cipher.c:311:12: note: in expansion of macro 'min'
        todo = min(mo.length - oo, obl - obo);
               ^~~

vim +/min +890 include/linux/kernel.h

526211bc58c4b3 Ingo Molnar       2009-03-05  828  
^1da177e4c3f41 Linus Torvalds    2005-04-16  829  /*
3c8ba0d61d04ce Kees Cook         2018-03-30  830   * min()/max()/clamp() macros must accomplish three things:
3c8ba0d61d04ce Kees Cook         2018-03-30  831   *
3c8ba0d61d04ce Kees Cook         2018-03-30  832   * - avoid multiple evaluations of the arguments (so side-effects like
3c8ba0d61d04ce Kees Cook         2018-03-30  833   *   "x++" happen only once) when non-constant.
3c8ba0d61d04ce Kees Cook         2018-03-30  834   * - perform strict type-checking (to generate warnings instead of
3c8ba0d61d04ce Kees Cook         2018-03-30  835   *   nasty runtime surprises). See the "unnecessary" pointer comparison
3c8ba0d61d04ce Kees Cook         2018-03-30  836   *   in __typecheck().
3c8ba0d61d04ce Kees Cook         2018-03-30  837   * - retain result as a constant expressions when called with only
3c8ba0d61d04ce Kees Cook         2018-03-30  838   *   constant expressions (to avoid tripping VLA warnings in stack
3c8ba0d61d04ce Kees Cook         2018-03-30  839   *   allocation usage).
3c8ba0d61d04ce Kees Cook         2018-03-30  840   */
3c8ba0d61d04ce Kees Cook         2018-03-30  841  #define __typecheck(x, y) \
3c8ba0d61d04ce Kees Cook         2018-03-30  842  		(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
3c8ba0d61d04ce Kees Cook         2018-03-30  843  
3c8ba0d61d04ce Kees Cook         2018-03-30  844  /*
3c8ba0d61d04ce Kees Cook         2018-03-30  845   * This returns a constant expression while determining if an argument is
3c8ba0d61d04ce Kees Cook         2018-03-30  846   * a constant expression, most importantly without evaluating the argument.
3c8ba0d61d04ce Kees Cook         2018-03-30  847   * Glory to Martin Uecker <Martin.Uecker@med.uni-goettingen.de>
^1da177e4c3f41 Linus Torvalds    2005-04-16  848   */
3c8ba0d61d04ce Kees Cook         2018-03-30  849  #define __is_constexpr(x) \
3c8ba0d61d04ce Kees Cook         2018-03-30  850  	(sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
3c8ba0d61d04ce Kees Cook         2018-03-30  851  
3c8ba0d61d04ce Kees Cook         2018-03-30  852  #define __no_side_effects(x, y) \
3c8ba0d61d04ce Kees Cook         2018-03-30  853  		(__is_constexpr(x) && __is_constexpr(y))
3c8ba0d61d04ce Kees Cook         2018-03-30  854  
3c8ba0d61d04ce Kees Cook         2018-03-30  855  #define __safe_cmp(x, y) \
3c8ba0d61d04ce Kees Cook         2018-03-30 @856  		(__typecheck(x, y) && __no_side_effects(x, y))
3c8ba0d61d04ce Kees Cook         2018-03-30  857  
3c8ba0d61d04ce Kees Cook         2018-03-30  858  #define __cmp(x, y, op)	((x) op (y) ? (x) : (y))
3c8ba0d61d04ce Kees Cook         2018-03-30  859  
e9092d0d979611 Linus Torvalds    2018-04-09  860  #define __cmp_once(x, y, unique_x, unique_y, op) ({	\
e9092d0d979611 Linus Torvalds    2018-04-09  861  		typeof(x) unique_x = (x);		\
e9092d0d979611 Linus Torvalds    2018-04-09  862  		typeof(y) unique_y = (y);		\
e9092d0d979611 Linus Torvalds    2018-04-09  863  		__cmp(unique_x, unique_y, op); })
3c8ba0d61d04ce Kees Cook         2018-03-30  864  
3c8ba0d61d04ce Kees Cook         2018-03-30  865  #define __careful_cmp(x, y, op) \
3c8ba0d61d04ce Kees Cook         2018-03-30  866  	__builtin_choose_expr(__safe_cmp(x, y), \
e9092d0d979611 Linus Torvalds    2018-04-09  867  		__cmp(x, y, op), \
e9092d0d979611 Linus Torvalds    2018-04-09  868  		__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
e8c97af0c1f23d Randy Dunlap      2017-10-13  869  
e8c97af0c1f23d Randy Dunlap      2017-10-13  870  /**
e8c97af0c1f23d Randy Dunlap      2017-10-13  871   * min - return minimum of two values of the same or compatible types
e8c97af0c1f23d Randy Dunlap      2017-10-13  872   * @x: first value
e8c97af0c1f23d Randy Dunlap      2017-10-13  873   * @y: second value
e8c97af0c1f23d Randy Dunlap      2017-10-13  874   */
3c8ba0d61d04ce Kees Cook         2018-03-30  875  #define min(x, y)	__careful_cmp(x, y, <)
e8c97af0c1f23d Randy Dunlap      2017-10-13  876  
e8c97af0c1f23d Randy Dunlap      2017-10-13  877  /**
e8c97af0c1f23d Randy Dunlap      2017-10-13  878   * max - return maximum of two values of the same or compatible types
e8c97af0c1f23d Randy Dunlap      2017-10-13  879   * @x: first value
e8c97af0c1f23d Randy Dunlap      2017-10-13  880   * @y: second value
e8c97af0c1f23d Randy Dunlap      2017-10-13  881   */
3c8ba0d61d04ce Kees Cook         2018-03-30  882  #define max(x, y)	__careful_cmp(x, y, >)
bdf4bbaaee3d4b Harvey Harrison   2008-04-30  883  
e8c97af0c1f23d Randy Dunlap      2017-10-13  884  /**
e8c97af0c1f23d Randy Dunlap      2017-10-13  885   * min3 - return minimum of three values
e8c97af0c1f23d Randy Dunlap      2017-10-13  886   * @x: first value
e8c97af0c1f23d Randy Dunlap      2017-10-13  887   * @y: second value
e8c97af0c1f23d Randy Dunlap      2017-10-13  888   * @z: third value
e8c97af0c1f23d Randy Dunlap      2017-10-13  889   */
2e1d06e1c05af9 Michal Nazarewicz 2014-10-09 @890  #define min3(x, y, z) min((typeof(x))min(x, y), z)
e8c97af0c1f23d Randy Dunlap      2017-10-13  891  

:::::: The code at line 890 was first introduced by commit
:::::: 2e1d06e1c05af9dbe8a3bfddeefbf041ca637fff include/linux/kernel.h: rewrite min3, max3 and clamp using min and max

:::::: TO: Michal Nazarewicz <mina86@mina86.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 67290 bytes --]

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

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

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

^ permalink raw reply	[flat|nested] 5+ 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; 5+ messages in thread
From: Herbert Xu @ 2019-11-22 11:03 UTC (permalink / raw)
  To: Corentin Labbe
  Cc: davem, mripard, wens, linux-arm-kernel, linux-crypto,
	linux-kernel, linux-sunxi

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

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

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

Thread overview: 5+ 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
2019-11-18  7:12   ` kbuild test robot
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).