[gabbayo:habanalabs-next 23/24] drivers/misc//habanalabs/habanalabs_ioctl.c:149:29: warning: cast to pointer from integer of different size

kbuild test robot lkp at intel.com
Tue Apr 2 09:36:33 UTC 2019


tree:   git://people.freedesktop.org/~gabbayo/linux habanalabs-next
head:   aaebb2539ebbebac78f31df2d6ea9f463a27cb8c
commit: 0778d45ef52dd3b9bc92765de7e7f97a80224a06 [23/24] habanalabs: add new IOCTL for debug, tracing and profiling
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 0778d45ef52dd3b9bc92765de7e7f97a80224a06
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=mips 

All warnings (new ones prefixed by >>):

   drivers/misc//habanalabs/habanalabs_ioctl.c: In function 'debug_coresight':
>> drivers/misc//habanalabs/habanalabs_ioctl.c:149:29: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      if (copy_from_user(input, (void __user *)args->input_ptr,
                                ^
   drivers/misc//habanalabs/habanalabs_ioctl.c:179:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      if (copy_to_user((void __user *)args->output_ptr, output,
                       ^

vim +149 drivers/misc//habanalabs/habanalabs_ioctl.c

   127	
   128	static int debug_coresight(struct hl_device *hdev, struct hl_debug_args *args)
   129	{
   130		struct hl_debug_params *params;
   131		void *input = NULL, *output = NULL;
   132		int rc;
   133	
   134		params = kzalloc(sizeof(*params), GFP_KERNEL);
   135		if (!params)
   136			return -ENOMEM;
   137	
   138		params->reg_idx = args->reg_idx;
   139		params->enable = args->enable;
   140		params->op = args->op;
   141	
   142		if (args->input_ptr && args->input_size) {
   143			input = kzalloc(args->input_size, GFP_KERNEL);
   144			if (!input) {
   145				rc = -ENOMEM;
   146				goto out;
   147			}
   148	
 > 149			if (copy_from_user(input, (void __user *)args->input_ptr,
   150					args->input_size)) {
   151				dev_err(hdev->dev,
   152					"copy from user failed in debug ioctl\n");
   153				rc = -EFAULT;
   154				goto out;
   155			}
   156	
   157			params->input = input;
   158		}
   159	
   160		if (args->output_ptr && args->output_size) {
   161			output = kzalloc(args->output_size, GFP_KERNEL);
   162			if (!output) {
   163				rc = -ENOMEM;
   164				goto out;
   165			}
   166	
   167			params->output = output;
   168			params->output_size = args->output_size;
   169		}
   170	
   171		rc = hdev->asic_funcs->debug_coresight(hdev, params);
   172		if (rc) {
   173			dev_err(hdev->dev,
   174				"debug coresight operation failed %d\n", rc);
   175			goto out;
   176		}
   177	
   178		if (output) {
   179			if (copy_to_user((void __user *)args->output_ptr, output,
   180					args->output_size)) {
   181				dev_err(hdev->dev,
   182					"copy to user failed in debug ioctl\n");
   183				rc = -EFAULT;
   184				goto out;
   185			}
   186		}
   187	
   188	out:
   189		kfree(params);
   190		kfree(output);
   191		kfree(input);
   192	
   193		return rc;
   194	}
   195	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 59282 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20190402/af01bd7a/attachment-0001.gz>


More information about the dri-devel mailing list