All of lore.kernel.org
 help / color / mirror / Atom feed
* [freescale-fslc:5.10-2.1.x-imx 13106/14697] drivers/firmware/imx/s400-api.c:446:24: warning: cast to pointer from integer of different size
@ 2021-10-04 22:58 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-10-04 22:58 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://github.com/Freescale/linux-fslc 5.10-2.1.x-imx
head:   d104abae22e109f942a3bb42ba4460e610c21965
commit: a2200b05f4efbd789c8dc61bfcde03931ac058bf [13106/14697] MLK25252: S4_MUAP: added support for image authentication
config: parisc-randconfig-r036-20211004 (attached as .config)
compiler: hppa-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/Freescale/linux-fslc/commit/a2200b05f4efbd789c8dc61bfcde03931ac058bf
        git remote add freescale-fslc https://github.com/Freescale/linux-fslc
        git fetch --no-tags freescale-fslc 5.10-2.1.x-imx
        git checkout a2200b05f4efbd789c8dc61bfcde03931ac058bf
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=parisc 

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

All warnings (new ones prefixed by >>):

   drivers/firmware/imx/s400-api.c:245:16: warning: no previous prototype for 'imx_soc_device_register' [-Wmissing-prototypes]
     245 | struct device *imx_soc_device_register(void)
         |                ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/firmware/imx/s400-api.c: In function 's4_muap_ioctl_img_auth_cmd_handler':
>> drivers/firmware/imx/s400-api.c:446:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     446 |                 memcpy((void *)img->dst, (const void *)(img->offset + phdr),
         |                        ^
   drivers/firmware/imx/s400-api.c:452:17: error: implicit declaration of function '__flush_dcache_area'; did you mean 'flush_dcache_page'? [-Werror=implicit-function-declaration]
     452 |                 __flush_dcache_area((void *) s, e);
         |                 ^~~~~~~~~~~~~~~~~~~
         |                 flush_dcache_page
   cc1: some warnings being treated as errors


vim +446 drivers/firmware/imx/s400-api.c

   338	
   339	static int s4_muap_ioctl_get_info(struct s4_mu_device_ctx *dev_ctx,
   340					  unsigned long arg)
   341	{
   342		struct imx_s400_api *s400_muap_priv = dev_ctx->s400_muap_priv;
   343		struct s4_read_info info;
   344	
   345		int ret = -EINVAL;
   346	
   347		ret = (int)copy_from_user(&info, (u8 *)arg,
   348				sizeof(info));
   349		if (ret) {
   350			devctx_err(dev_ctx, "Fail copy shared memory config to user\n");
   351			ret = -EFAULT;
   352			goto exit;
   353		}
   354	
   355		s400_muap_priv->tx_msg.header = (s400_muap_priv->cmd_tag << 24) |
   356						(info.cmd_id << 16) |
   357						(info.size << 8) |
   358						S400_VERSION;
   359	
   360		ret = imx_s400_api_call(s400_muap_priv, (void *) &info.resp);
   361		if (ret) {
   362			devctx_err(dev_ctx, "%s: imx_s400_api_call failed for cmd [0x%x]\n",
   363					__func__, info.cmd_id);
   364			ret = -EIO;
   365		}
   366	
   367		ret = (int)copy_to_user((u8 *)arg, &info,
   368			sizeof(info));
   369		if (ret) {
   370			devctx_err(dev_ctx, "Failed to copy iobuff setup to user\n");
   371			ret = -EFAULT;
   372		}
   373	
   374	exit:
   375		return ret;
   376	}
   377	static int s4_muap_ioctl_img_auth_cmd_handler(struct s4_mu_device_ctx *dev_ctx,
   378						      unsigned long arg)
   379	{
   380		struct imx_s400_api *s400_muap_priv = dev_ctx->s400_muap_priv;
   381		struct s4_muap_auth_image s4_muap_auth_image;
   382		struct container_hdr *phdr = &s4_muap_auth_image.chdr;
   383		struct image_info *img = &s4_muap_auth_image.img_info[0];
   384		unsigned long base_addr = (unsigned long) &s4_muap_auth_image;
   385	
   386		int i;
   387		u16 length;
   388		unsigned long s, e;
   389		int ret = -EINVAL;
   390	
   391		/* Check if not already configured. */
   392		if (dev_ctx->secure_mem.dma_addr != 0u) {
   393			devctx_err(dev_ctx, "Shared memory not configured\n");
   394			goto exit;
   395		}
   396	
   397		ret = (int)copy_from_user(&s4_muap_auth_image, (u8 *)arg,
   398				sizeof(s4_muap_auth_image));
   399		if (ret) {
   400			devctx_err(dev_ctx, "Fail copy shared memory config to user\n");
   401			ret = -EFAULT;
   402			goto exit;
   403		}
   404	
   405	
   406		if (!IS_ALIGNED(base_addr, 4)) {
   407			devctx_err(dev_ctx, "Error: Image's address is not 4 byte aligned\n");
   408			return -EINVAL;
   409		}
   410	
   411		if (phdr->tag != 0x87 && phdr->version != 0x0) {
   412			devctx_err(dev_ctx, "Error: Wrong container header\n");
   413			return -EFAULT;
   414		}
   415	
   416		if (!phdr->num_images) {
   417			devctx_err(dev_ctx, "Error: Wrong container, no image found\n");
   418			return -EFAULT;
   419		}
   420		length = phdr->length_lsb + (phdr->length_msb << 8);
   421	
   422		devctx_dbg(dev_ctx, "container length %u\n", length);
   423	
   424		s400_muap_priv->tx_msg.header = (s400_muap_priv->cmd_tag << 24) |
   425						(S400_OEM_CNTN_AUTH_REQ << 16) |
   426						(S400_OEM_CNTN_AUTH_REQ_SIZE << 8) |
   427						S400_VERSION;
   428		s400_muap_priv->tx_msg.data[0] = ((u32)(((base_addr) >> 16) >> 16));
   429		s400_muap_priv->tx_msg.data[1] = ((u32)(base_addr));
   430	
   431		ret = imx_s400_api_call(s400_muap_priv, (void *) &s4_muap_auth_image.resp);
   432		if (ret || (s4_muap_auth_image.resp != S400_SUCCESS_IND)) {
   433			devctx_err(dev_ctx, "Error: Container Authentication failed.\n");
   434			ret = -EIO;
   435			goto exit;
   436		}
   437	
   438		/* Copy images to dest address */
   439		for (i = 0; i < phdr->num_images; i++) {
   440			img = img + i;
   441	
   442			//devctx_dbg(dev_ctx, "img %d, dst 0x%x, src 0x%lux, size 0x%x\n",
   443			//		i, (u32) img->dst,
   444			//		(unsigned long)img->offset + phdr, img->size);
   445	
 > 446			memcpy((void *)img->dst, (const void *)(img->offset + phdr),
   447					img->size);
   448	
   449			s = img->dst & ~(CACHELINE_SIZE - 1);
   450			e = ALIGN(img->dst + img->size, CACHELINE_SIZE) - 1;
   451	
   452			__flush_dcache_area((void *) s, e);
   453			s400_muap_priv->tx_msg.header = (s400_muap_priv->cmd_tag << 24) |
   454							(S400_VERIFY_IMAGE_REQ << 16) |
   455							(S400_VERIFY_IMAGE_REQ_SIZE << 8) |
   456							S400_VERSION;
   457			s400_muap_priv->tx_msg.data[0] = 1 << i;
   458			ret = imx_s400_api_call(s400_muap_priv, (void *) &s4_muap_auth_image.resp);
   459			if (ret || (s4_muap_auth_image.resp != S400_SUCCESS_IND)) {
   460				devctx_err(dev_ctx, "Error: Image Verification failed.\n");
   461				ret = -EIO;
   462				goto exit;
   463			}
   464		}
   465	
   466	exit:
   467		s400_muap_priv->tx_msg.header = (s400_muap_priv->cmd_tag << 24) |
   468						(S400_RELEASE_CONTAINER_REQ << 16) |
   469						(S400_RELEASE_CONTAINER_REQ_SIZE << 8) |
   470						S400_VERSION;
   471		ret = imx_s400_api_call(s400_muap_priv, (void *) &s4_muap_auth_image.resp);
   472		if (ret || (s4_muap_auth_image.resp != S400_SUCCESS_IND)) {
   473			devctx_err(dev_ctx, "Error: Release Container failed.\n");
   474			ret = -EIO;
   475		}
   476	
   477		ret = (int)copy_to_user((u8 *)arg, &s4_muap_auth_image,
   478			sizeof(s4_muap_auth_image));
   479		if (ret) {
   480			devctx_err(dev_ctx, "Failed to copy iobuff setup to user\n");
   481			ret = -EFAULT;
   482		}
   483		return ret;
   484	}
   485	

---
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: 29773 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-04 22:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-04 22:58 [freescale-fslc:5.10-2.1.x-imx 13106/14697] drivers/firmware/imx/s400-api.c:446:24: warning: cast to pointer from integer of different size kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.