mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* drivers/crypto/stm32/stm32-cryp.c:1232:47: sparse: sparse: incorrect type in argument 2 (different base types)
@ 2020-12-29  3:26 kernel test robot
  2021-01-04  6:15 ` crypto: stm32 - Fix last sparse warning in stm32_cryp_check_ctr_counter Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2020-12-29  3:26 UTC (permalink / raw)
  To: Herbert Xu; +Cc: kbuild-all, linux-kernel

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   dea8dcf2a9fa8cc540136a6cd885c3beece16ec3
commit: bbb2832620ac4e136416aa97af7310636422dea9 crypto: stm32 - Fix sparse warnings
date:   4 months ago
config: arm-randconfig-s032-20201220 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-184-g1b896707-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bbb2832620ac4e136416aa97af7310636422dea9
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout bbb2832620ac4e136416aa97af7310636422dea9
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


"sparse warnings: (new ones prefixed by >>)"
>> drivers/crypto/stm32/stm32-cryp.c:1232:47: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected restricted __be32 [usertype] *[assigned] iv @@     got unsigned int [usertype] * @@
   drivers/crypto/stm32/stm32-cryp.c:1232:47: sparse:     expected restricted __be32 [usertype] *[assigned] iv
   drivers/crypto/stm32/stm32-cryp.c:1232:47: sparse:     got unsigned int [usertype] *

vim +1232 drivers/crypto/stm32/stm32-cryp.c

9d3b5030bc1e44f Fabien DESSENNE 2018-02-07  1215  
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1216  static void stm32_cryp_check_ctr_counter(struct stm32_cryp *cryp)
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1217  {
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1218  	u32 cr;
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1219  
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1220  	if (unlikely(cryp->last_ctr[3] == 0xFFFFFFFF)) {
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1221  		cryp->last_ctr[3] = 0;
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1222  		cryp->last_ctr[2]++;
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1223  		if (!cryp->last_ctr[2]) {
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1224  			cryp->last_ctr[1]++;
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1225  			if (!cryp->last_ctr[1])
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1226  				cryp->last_ctr[0]++;
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1227  		}
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1228  
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1229  		cr = stm32_cryp_read(cryp, CRYP_CR);
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1230  		stm32_cryp_write(cryp, CRYP_CR, cr & ~CR_CRYPEN);
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1231  
9e054ec21ef8344 Fabien DESSENNE 2017-10-19 @1232  		stm32_cryp_hw_write_iv(cryp, (u32 *)cryp->last_ctr);
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1233  
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1234  		stm32_cryp_write(cryp, CRYP_CR, cr);
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1235  	}
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1236  
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1237  	cryp->last_ctr[0] = stm32_cryp_read(cryp, CRYP_IV0LR);
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1238  	cryp->last_ctr[1] = stm32_cryp_read(cryp, CRYP_IV0RR);
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1239  	cryp->last_ctr[2] = stm32_cryp_read(cryp, CRYP_IV1LR);
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1240  	cryp->last_ctr[3] = stm32_cryp_read(cryp, CRYP_IV1RR);
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1241  }
9e054ec21ef8344 Fabien DESSENNE 2017-10-19  1242  

:::::: The code at line 1232 was first introduced by commit
:::::: 9e054ec21ef8344345b28603fb272fe999f735db crypto: stm32 - Support for STM32 CRYP crypto module

:::::: TO: Fabien DESSENNE <fabien.dessenne@st.com>
:::::: CC: Herbert Xu <herbert@gondor.apana.org.au>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

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

* crypto: stm32 - Fix last sparse warning in stm32_cryp_check_ctr_counter
  2020-12-29  3:26 drivers/crypto/stm32/stm32-cryp.c:1232:47: sparse: sparse: incorrect type in argument 2 (different base types) kernel test robot
@ 2021-01-04  6:15 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2021-01-04  6:15 UTC (permalink / raw)
  To: kernel test robot; +Cc: kbuild-all, linux-kernel, Linux Crypto Mailing List

On Tue, Dec 29, 2020 at 11:26:45AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   dea8dcf2a9fa8cc540136a6cd885c3beece16ec3
> commit: bbb2832620ac4e136416aa97af7310636422dea9 crypto: stm32 - Fix sparse warnings
> date:   4 months ago
> config: arm-randconfig-s032-20201220 (attached as .config)
> compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
> reproduce:
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # apt-get install sparse
>         # sparse version: v0.6.3-184-g1b896707-dirty
>         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bbb2832620ac4e136416aa97af7310636422dea9
>         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>         git fetch --no-tags linus master
>         git checkout bbb2832620ac4e136416aa97af7310636422dea9
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> 
> "sparse warnings: (new ones prefixed by >>)"
> >> drivers/crypto/stm32/stm32-cryp.c:1232:47: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected restricted __be32 [usertype] *[assigned] iv @@     got unsigned int [usertype] * @@
>    drivers/crypto/stm32/stm32-cryp.c:1232:47: sparse:     expected restricted __be32 [usertype] *[assigned] iv
>    drivers/crypto/stm32/stm32-cryp.c:1232:47: sparse:     got unsigned int [usertype] *

This patch should fix the problem.

---8<---
This patch changes the cast in stm32_cryp_check_ctr_counter from
u32 to __be32 to match the prototype of stm32_cryp_hw_write_iv
correctly.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32-cryp.c
index 2670c30332fa..2a4793176c71 100644
--- a/drivers/crypto/stm32/stm32-cryp.c
+++ b/drivers/crypto/stm32/stm32-cryp.c
@@ -1229,7 +1229,7 @@ static void stm32_cryp_check_ctr_counter(struct stm32_cryp *cryp)
 		cr = stm32_cryp_read(cryp, CRYP_CR);
 		stm32_cryp_write(cryp, CRYP_CR, cr & ~CR_CRYPEN);
 
-		stm32_cryp_hw_write_iv(cryp, (u32 *)cryp->last_ctr);
+		stm32_cryp_hw_write_iv(cryp, (__be32 *)cryp->last_ctr);
 
 		stm32_cryp_write(cryp, CRYP_CR, cr);
 	}
-- 
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] 2+ messages in thread

end of thread, other threads:[~2021-01-04  6:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-29  3:26 drivers/crypto/stm32/stm32-cryp.c:1232:47: sparse: sparse: incorrect type in argument 2 (different base types) kernel test robot
2021-01-04  6:15 ` crypto: stm32 - Fix last sparse warning in stm32_cryp_check_ctr_counter Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®