Message ID | 20240621082053.638952-8-pavitrakumarm@vayavyalabs.com |
---|---|
State | Superseded |
Headers | show |
Series | Add SPAcc Crypto Driver Support | expand |
Hi Pavitrakumar, kernel test robot noticed the following build warnings: url: https://github.com/intel-lab-lkp/linux/commits/Pavitrakumar-M/Add-SPAcc-Skcipher-support/20240625-184208 base: 1dcf865d3bf5bff45e93cb2410911b3428dacb78 patch link: https://lore.kernel.org/r/20240621082053.638952-8-pavitrakumarm%40vayavyalabs.com patch subject: [PATCH v5 7/7] Enable Driver compilation in crypto Kconfig and Makefile config: x86_64-randconfig-161-20240626 (https://download.01.org/0day-ci/archive/20240626/202406260926.bfyJ84yf-lkp@intel.com/config) compiler: gcc-10 (Ubuntu 10.5.0-1ubuntu1) 10.5.0 If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org> | Closes: https://lore.kernel.org/r/202406260926.bfyJ84yf-lkp@intel.com/ New smatch warnings: drivers/crypto/dwc-spacc/spacc_core.c:1029 fixup_sg() error: we previously assumed 'sg' could be null (see line 1008) Old smatch warnings: drivers/crypto/dwc-spacc/spacc_core.c:1417 spacc_isenabled() error: buffer overflow 'spacc->config.modes' 81 <= 81 drivers/crypto/dwc-spacc/spacc_core.c:1422 spacc_isenabled() error: buffer overflow 'spacc->config.modes' 81 <= 81 drivers/crypto/dwc-spacc/spacc_core.c:2018 spacc_open() warn: inconsistent indenting vim +/sg +1029 drivers/crypto/dwc-spacc/spacc_core.c 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1003 static int fixup_sg(struct scatterlist *sg, int nbytes) 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1004 { 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1005 int sg_nents = 0; 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1006 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1007 while (nbytes > 0) { 8e3d92f71646e6 Pavitrakumar M 2024-06-21 @1008 if (sg && sg->length) { Can we really pass a NULL sg? 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1009 ++sg_nents; 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1010 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1011 if (sg->length > nbytes) 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1012 return sg_nents; 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1013 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1014 nbytes -= sg->length; 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1015 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1016 sg = sg_next(sg); 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1017 if (!sg) 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1018 break; 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1019 /* WARNING: sg->length may be > nbytes */ 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1020 } else { 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1021 /* 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1022 * The Linux crypto system uses its own SG chaining 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1023 * method which is slightly incompatible with the 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1024 * generic SG chaining. In particular, dma_map_sg does 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1025 * not support this method. Turn them into proper 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1026 * chained SGs here (which dma_map_sg does 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1027 * support) as a workaround. 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1028 */ 8e3d92f71646e6 Pavitrakumar M 2024-06-21 @1029 spacc_sg_chain(sg, 1, sg_chain_ptr(sg)); ^^^ ^^ Because if so, we're toast. 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1030 sg = sg_chain_ptr(sg); 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1031 if (!sg) 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1032 break; 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1033 } 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1034 } 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1035 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1036 return sg_nents; 8e3d92f71646e6 Pavitrakumar M 2024-06-21 1037 }
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index 94f23c6fc93b..009cbd0e1993 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig @@ -696,6 +696,7 @@ config CRYPTO_DEV_BCM_SPU ahash, and aead algorithms with the kernel cryptographic API. source "drivers/crypto/stm32/Kconfig" +source "drivers/crypto/dwc-spacc/Kconfig" config CRYPTO_DEV_SAFEXCEL tristate "Inside Secure's SafeXcel cryptographic engine driver" diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile index ad4ccef67d12..a937e8f5849b 100644 --- a/drivers/crypto/Makefile +++ b/drivers/crypto/Makefile @@ -48,6 +48,7 @@ obj-$(CONFIG_CRYPTO_DEV_BCM_SPU) += bcm/ obj-$(CONFIG_CRYPTO_DEV_SAFEXCEL) += inside-secure/ obj-$(CONFIG_CRYPTO_DEV_ARTPEC6) += axis/ obj-y += xilinx/ +obj-y += dwc-spacc/ obj-y += hisilicon/ obj-$(CONFIG_CRYPTO_DEV_AMLOGIC_GXL) += amlogic/ obj-y += intel/