lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 13 Oct 2022 01:42:37 +0800
From:   kernel test robot <lkp@...el.com>
To:     Saurabh Sengar <ssengar@...ux.microsoft.com>,
        ssengar@...rosoft.com, kys@...rosoft.com, haiyangz@...rosoft.com,
        sthemmin@...rosoft.com, wei.liu@...nel.org, decui@...rosoft.com,
        longli@...rosoft.com, gregkh@...uxfoundation.org,
        linux-hyperv@...r.kernel.org, linux-kernel@...r.kernel.org,
        mikelley@...rosoft.com
Cc:     kbuild-all@...ts.01.org
Subject: Re: [PATCH] uio_hv_generic: Enable support for slower vmbus device
 channels

Hi Saurabh,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on linus/master v6.0 next-20221012]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Saurabh-Sengar/uio_hv_generic-Enable-support-for-slower-vmbus-device-channels/20221012-195731
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 49da070062390094112b423ba443ea193527b2e4
config: i386-randconfig-a005
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/e7d62290b320f0f50c4f09b8f869b9049ef2c2bd
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Saurabh-Sengar/uio_hv_generic-Enable-support-for-slower-vmbus-device-channels/20221012-195731
        git checkout e7d62290b320f0f50c4f09b8f869b9049ef2c2bd
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/uio/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/module.h:22,
                    from include/linux/device/driver.h:21,
                    from include/linux/device.h:32,
                    from drivers/uio/uio_hv_generic.c:22:
   drivers/uio/uio_hv_generic.c: In function '__check_recv_buf_size':
   include/linux/moduleparam.h:150:34: error: returning 'size_t *' {aka 'unsigned int *'} from a function with incompatible return type 'long unsigned int *' [-Werror=incompatible-pointer-types]
     150 |         param_check_##type(name, &(value));                                \
         |                                  ^
   include/linux/moduleparam.h:409:75: note: in definition of macro '__param_check'
     409 |         static inline type __always_unused *__check_##name(void) { return(p); }
         |                                                                           ^
   include/linux/moduleparam.h:150:9: note: in expansion of macro 'param_check_ulong'
     150 |         param_check_##type(name, &(value));                                \
         |         ^~~~~~~~~~~~
   include/linux/moduleparam.h:127:9: note: in expansion of macro 'module_param_named'
     127 |         module_param_named(name, name, type, perm)
         |         ^~~~~~~~~~~~~~~~~~
   drivers/uio/uio_hv_generic.c:44:1: note: in expansion of macro 'module_param'
      44 | module_param(recv_buf_size, ulong, 0644);
         | ^~~~~~~~~~~~
   drivers/uio/uio_hv_generic.c: In function '__check_send_buf_size':
   include/linux/moduleparam.h:150:34: error: returning 'size_t *' {aka 'unsigned int *'} from a function with incompatible return type 'long unsigned int *' [-Werror=incompatible-pointer-types]
     150 |         param_check_##type(name, &(value));                                \
         |                                  ^
   include/linux/moduleparam.h:409:75: note: in definition of macro '__param_check'
     409 |         static inline type __always_unused *__check_##name(void) { return(p); }
         |                                                                           ^
   include/linux/moduleparam.h:150:9: note: in expansion of macro 'param_check_ulong'
     150 |         param_check_##type(name, &(value));                                \
         |         ^~~~~~~~~~~~
   include/linux/moduleparam.h:127:9: note: in expansion of macro 'module_param_named'
     127 |         module_param_named(name, name, type, perm)
         |         ^~~~~~~~~~~~~~~~~~
   drivers/uio/uio_hv_generic.c:48:1: note: in expansion of macro 'module_param'
      48 | module_param(send_buf_size, ulong, 0644);
         | ^~~~~~~~~~~~
   drivers/uio/uio_hv_generic.c: In function '__check_ring_size':
   include/linux/moduleparam.h:150:34: error: returning 'size_t *' {aka 'unsigned int *'} from a function with incompatible return type 'long unsigned int *' [-Werror=incompatible-pointer-types]
     150 |         param_check_##type(name, &(value));                                \
         |                                  ^
   include/linux/moduleparam.h:409:75: note: in definition of macro '__param_check'
     409 |         static inline type __always_unused *__check_##name(void) { return(p); }
         |                                                                           ^
   include/linux/moduleparam.h:150:9: note: in expansion of macro 'param_check_ulong'
     150 |         param_check_##type(name, &(value));                                \
         |         ^~~~~~~~~~~~
   include/linux/moduleparam.h:127:9: note: in expansion of macro 'module_param_named'
     127 |         module_param_named(name, name, type, perm)
         |         ^~~~~~~~~~~~~~~~~~
   drivers/uio/uio_hv_generic.c:52:1: note: in expansion of macro 'module_param'
      52 | module_param(ring_size, ulong, 0644);
         | ^~~~~~~~~~~~
   In file included from include/linux/printk.h:566,
                    from include/linux/kernel.h:29,
                    from arch/x86/include/asm/percpu.h:27,
                    from arch/x86/include/asm/current.h:6,
                    from include/linux/sched.h:12,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from drivers/uio/uio_hv_generic.c:22:
   drivers/uio/uio_hv_generic.c: In function 'hv_uio_probe':
>> drivers/uio/uio_hv_generic.c:256:31: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
     256 |         dev_dbg(&dev->device, "primary channel ring size = %lx", ring_size);
         |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:223:29: note: in definition of macro '__dynamic_func_call_cls'
     223 |                 func(&id, ##__VA_ARGS__);                       \
         |                             ^~~~~~~~~~~
   include/linux/dynamic_debug.h:249:9: note: in expansion of macro '_dynamic_func_call_cls'
     249 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:272:9: note: in expansion of macro '_dynamic_func_call'
     272 |         _dynamic_func_call(fmt, __dynamic_dev_dbg,              \
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_dev_dbg'
     155 |         dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~
   include/linux/dev_printk.h:155:30: note: in expansion of macro 'dev_fmt'
     155 |         dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                              ^~~~~~~
   drivers/uio/uio_hv_generic.c:256:9: note: in expansion of macro 'dev_dbg'
     256 |         dev_dbg(&dev->device, "primary channel ring size = %lx", ring_size);
         |         ^~~~~~~
   drivers/uio/uio_hv_generic.c:256:62: note: format string is defined here
     256 |         dev_dbg(&dev->device, "primary channel ring size = %lx", ring_size);
         |                                                            ~~^
         |                                                              |
         |                                                              long unsigned int
         |                                                            %x
   cc1: some warnings being treated as errors


vim +256 drivers/uio/uio_hv_generic.c

   246	
   247	static int
   248	hv_uio_probe(struct hv_device *dev,
   249		     const struct hv_vmbus_device_id *dev_id)
   250	{
   251		struct vmbus_channel *channel = dev->channel;
   252		struct hv_uio_private_data *pdata;
   253		void *ring_buffer;
   254		int ret;
   255	
 > 256		dev_dbg(&dev->device, "primary channel ring size = %lx", ring_size);
   257	
   258		pdata = devm_kzalloc(&dev->device, sizeof(*pdata), GFP_KERNEL);
   259		if (!pdata)
   260			return -ENOMEM;
   261	
   262		ret = vmbus_alloc_ring(channel, ring_size, ring_size);
   263		if (ret)
   264			return ret;
   265	
   266		set_channel_read_mode(channel, HV_CALL_ISR);
   267	
   268		/* Fill general uio info */
   269		pdata->info.name = "uio_hv_generic";
   270		pdata->info.version = DRIVER_VERSION;
   271		pdata->info.irqcontrol = hv_uio_irqcontrol;
   272		pdata->info.open = hv_uio_open;
   273		pdata->info.release = hv_uio_release;
   274		pdata->info.irq = UIO_IRQ_CUSTOM;
   275		atomic_set(&pdata->refcnt, 0);
   276	
   277		/* mem resources */
   278		pdata->info.mem[TXRX_RING_MAP].name = "txrx_rings";
   279		ring_buffer = page_address(channel->ringbuffer_page);
   280		pdata->info.mem[TXRX_RING_MAP].addr
   281			= (uintptr_t)virt_to_phys(ring_buffer);
   282		pdata->info.mem[TXRX_RING_MAP].size
   283			= channel->ringbuffer_pagecount << PAGE_SHIFT;
   284		pdata->info.mem[TXRX_RING_MAP].memtype = UIO_MEM_IOVA;
   285	
   286		pdata->info.mem[INT_PAGE_MAP].name = "int_page";
   287		pdata->info.mem[INT_PAGE_MAP].addr
   288			= (uintptr_t)vmbus_connection.int_page;
   289		pdata->info.mem[INT_PAGE_MAP].size = PAGE_SIZE;
   290		pdata->info.mem[INT_PAGE_MAP].memtype = UIO_MEM_LOGICAL;
   291	
   292		pdata->info.mem[MON_PAGE_MAP].name = "monitor_page";
   293		pdata->info.mem[MON_PAGE_MAP].addr
   294			= (uintptr_t)vmbus_connection.monitor_pages[1];
   295		pdata->info.mem[MON_PAGE_MAP].size = PAGE_SIZE;
   296		pdata->info.mem[MON_PAGE_MAP].memtype = UIO_MEM_LOGICAL;
   297	
   298		if (recv_buf_size) {
   299			dev_dbg(&dev->device, "recv buffer allocation");
   300			pdata->recv_buf = vzalloc(recv_buf_size);
   301			if (!pdata->recv_buf) {
   302				ret = -ENOMEM;
   303				goto fail_free_ring;
   304			}
   305	
   306			ret = vmbus_establish_gpadl(channel, pdata->recv_buf,
   307						    recv_buf_size, &pdata->recv_gpadl);
   308			if (ret) {
   309				vfree(pdata->recv_buf);
   310				goto fail_close;
   311			}
   312	
   313			/* put Global Physical Address Label in name */
   314			snprintf(pdata->recv_name, sizeof(pdata->recv_name),
   315				 "recv:%u", pdata->recv_gpadl.gpadl_handle);
   316			pdata->info.mem[RECV_BUF_MAP].name = pdata->recv_name;
   317			pdata->info.mem[RECV_BUF_MAP].addr = (uintptr_t)pdata->recv_buf;
   318			pdata->info.mem[RECV_BUF_MAP].size = recv_buf_size;
   319			pdata->info.mem[RECV_BUF_MAP].memtype = UIO_MEM_VIRTUAL;
   320		}
   321	
   322		if (send_buf_size) {
   323			dev_dbg(&dev->device, "send buffer allocation");
   324			pdata->send_buf = vzalloc(send_buf_size);
   325			if (!pdata->send_buf) {
   326				ret = -ENOMEM;
   327				goto fail_close;
   328			}
   329	
   330			ret = vmbus_establish_gpadl(channel, pdata->send_buf,
   331						    send_buf_size, &pdata->send_gpadl);
   332			if (ret) {
   333				vfree(pdata->send_buf);
   334				goto fail_close;
   335			}
   336	
   337			snprintf(pdata->send_name, sizeof(pdata->send_name),
   338				 "send:%u", pdata->send_gpadl.gpadl_handle);
   339			pdata->info.mem[SEND_BUF_MAP].name = pdata->send_name;
   340			pdata->info.mem[SEND_BUF_MAP].addr = (uintptr_t)pdata->send_buf;
   341			pdata->info.mem[SEND_BUF_MAP].size = send_buf_size;
   342			pdata->info.mem[SEND_BUF_MAP].memtype = UIO_MEM_VIRTUAL;
   343		}
   344	
   345		pdata->info.priv = pdata;
   346		pdata->device = dev;
   347	
   348		ret = uio_register_device(&dev->device, &pdata->info);
   349		if (ret) {
   350			dev_err(&dev->device, "hv_uio register failed\n");
   351			goto fail_close;
   352		}
   353	
   354		ret = sysfs_create_bin_file(&channel->kobj, &ring_buffer_bin_attr);
   355		if (ret)
   356			dev_notice(&dev->device,
   357				   "sysfs create ring bin file failed; %d\n", ret);
   358	
   359		hv_set_drvdata(dev, pdata);
   360	
   361		return 0;
   362	
   363	fail_close:
   364		hv_uio_cleanup(dev, pdata);
   365	fail_free_ring:
   366		vmbus_free_ring(dev->channel);
   367	
   368		return ret;
   369	}
   370	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (154797 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ