linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [xlnx:master 271/271] drivers/misc/xilinx-ai-engine/ai-engine-part.c:302:32: warning: passing argument 2 of 'copy_from_user' makes pointer from integer without a cast
@ 2021-02-09  2:56 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-02-09  2:56 UTC (permalink / raw)
  To: Tejus Siddagangaiah; +Cc: Michal Simek, kbuild-all, linux-arm-kernel

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

tree:   https://github.com/Xilinx/linux-xlnx master
head:   d3774573d5a9700273bd0c3ff82af157107f7fa6
commit: d3774573d5a9700273bd0c3ff82af157107f7fa6 [271/271] misc: xilinx-ai-engine: transaction mode ioctl
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.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/Xilinx/linux-xlnx/commit/d3774573d5a9700273bd0c3ff82af157107f7fa6
        git remote add xlnx https://github.com/Xilinx/linux-xlnx
        git fetch --no-tags xlnx master
        git checkout d3774573d5a9700273bd0c3ff82af157107f7fa6
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64 

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/misc/xilinx-ai-engine/ai-engine-part.c: In function 'aie_part_access_regs':
>> drivers/misc/xilinx-ai-engine/ai-engine-part.c:302:32: warning: passing argument 2 of 'copy_from_user' makes pointer from integer without a cast [-Wint-conversion]
     302 |    if (copy_from_user(tmp, args->dataptr, sizeof(u32) *
         |                            ~~~~^~~~~~~~~
         |                                |
         |                                __u64 {aka long long unsigned int}
   In file included from include/linux/sched/task.h:11,
                    from include/linux/sched/signal.h:9,
                    from include/linux/ptrace.h:7,
                    from arch/arm64/include/asm/kgdb.h:14,
                    from include/linux/kgdb.h:20,
                    from arch/arm64/include/asm/cacheflush.h:11,
                    from arch/arm64/include/asm/mmu_context.h:18,
                    from include/linux/mmu_context.h:5,
                    from drivers/misc/xilinx-ai-engine/ai-engine-part.c:17:
   include/linux/uaccess.h:141:45: note: expected 'const void *' but argument is of type '__u64' {aka 'long long unsigned int'}
     141 | copy_from_user(void *to, const void __user *from, unsigned long n)
         |                          ~~~~~~~~~~~~~~~~~~~^~~~
   drivers/misc/xilinx-ai-engine/ai-engine-part.c: In function 'aie_part_execute_transaction_from_user':
   drivers/misc/xilinx-ai-engine/ai-engine-part.c:365:35: warning: passing argument 2 of 'copy_from_user' makes pointer from integer without a cast [-Wint-conversion]
     365 |  if (copy_from_user(cmds, txn_inst.cmdsptr,
         |                           ~~~~~~~~^~~~~~~~
         |                                   |
         |                                   __u64 {aka long long unsigned int}
   In file included from include/linux/sched/task.h:11,
                    from include/linux/sched/signal.h:9,
                    from include/linux/ptrace.h:7,
                    from arch/arm64/include/asm/kgdb.h:14,
                    from include/linux/kgdb.h:20,
                    from arch/arm64/include/asm/cacheflush.h:11,
                    from arch/arm64/include/asm/mmu_context.h:18,
                    from include/linux/mmu_context.h:5,
                    from drivers/misc/xilinx-ai-engine/ai-engine-part.c:17:
   include/linux/uaccess.h:141:45: note: expected 'const void *' but argument is of type '__u64' {aka 'long long unsigned int'}
     141 | copy_from_user(void *to, const void __user *from, unsigned long n)
         |                          ~~~~~~~~~~~~~~~~~~~^~~~


vim +/copy_from_user +302 drivers/misc/xilinx-ai-engine/ai-engine-part.c

   262	
   263	/**
   264	 * aie_part_access_regs() - AI engine partition registers access
   265	 * @apart: AI engine partition
   266	 * @num_reqs: number of access requests
   267	 * @reqs: array of registers access
   268	 * @return: 0 for success, and negative value for failure.
   269	 *
   270	 * This function executes AI engine partition register access requests.
   271	 */
   272	static int aie_part_access_regs(struct aie_partition *apart, u32 num_reqs,
   273					struct aie_reg_args *reqs)
   274	{
   275		u32 i;
   276	
   277		for (i = 0; i < num_reqs; i++) {
   278			struct aie_reg_args *args = &reqs[i];
   279			int ret;
   280	
   281			switch (args->op) {
   282			case AIE_REG_WRITE:
   283			{
   284				ret = aie_part_write_register(apart,
   285							      (size_t)args->offset,
   286							      sizeof(args->val),
   287							      &args->val, args->mask);
   288				break;
   289			}
   290			case AIE_REG_BLOCKWRITE:
   291			{
   292				u32 *tmp;
   293	
   294				/*
   295				 * TODO: replace copy_from_user by pinning the user
   296				 * page for performance improvement.
   297				 */
   298				tmp = kcalloc(args->len, sizeof(u32), GFP_KERNEL);
   299				if (!tmp)
   300					return -ENOMEM;
   301	
 > 302				if (copy_from_user(tmp, args->dataptr, sizeof(u32) *
   303							args->len)) {
   304					kfree(tmp);
   305					return -EFAULT;
   306				}
   307	
   308				ret = aie_part_write_register(apart,
   309							      (size_t)args->offset,
   310							      sizeof(u32) * args->len,
   311							      tmp, args->mask);
   312				kfree(tmp);
   313				break;
   314			}
   315			case AIE_REG_BLOCKSET:
   316			{
   317				ret = aie_part_block_set(apart, args);
   318				break;
   319			}
   320			default:
   321				dev_err(&apart->dev,
   322					"Invalid register command type: %u.\n",
   323					args->op);
   324				return -EINVAL;
   325			}
   326	
   327			if (ret < 0) {
   328				dev_err(&apart->dev, "reg op %u failed: 0x%llx.\n",
   329					args->op, args->offset);
   330				return ret;
   331			}
   332		}
   333	
   334		return 0;
   335	}
   336	

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

[-- Attachment #3: Type: text/plain, Size: 176 bytes --]

_______________________________________________
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] only message in thread

only message in thread, other threads:[~2021-02-09  2:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-09  2:56 [xlnx:master 271/271] drivers/misc/xilinx-ai-engine/ai-engine-part.c:302:32: warning: passing argument 2 of 'copy_from_user' makes pointer from integer without a cast kernel test robot

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).