All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [chrome-os:chromeos-5.10 77/77] drivers/virtio/virtio_wl.c:892:15: error: implicit declaration of function 'vzalloc'; did you mean 'kzalloc'?
@ 2021-07-06 21:02 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-07-06 21:02 UTC (permalink / raw
  To: kbuild-all

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

tree:   https://chromium.googlesource.com/chromiumos/third_party/kernel chromeos-5.10
head:   300b775fa1ab25e08a75ae54a2ddbfb6190cb1e2
commit: 300b775fa1ab25e08a75ae54a2ddbfb6190cb1e2 [77/77] CHROMIUM: virtio-wl: Use vmalloc for larger messages in virtwl_vfd_send().
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-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
        git remote add chrome-os https://chromium.googlesource.com/chromiumos/third_party/kernel
        git fetch --no-tags chrome-os chromeos-5.10
        git checkout 300b775fa1ab25e08a75ae54a2ddbfb6190cb1e2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc 

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

All errors (new ones prefixed by >>):

   drivers/virtio/virtio_wl.c: In function 'virtwl_vfd_send':
>> drivers/virtio/virtio_wl.c:892:15: error: implicit declaration of function 'vzalloc'; did you mean 'kzalloc'? [-Werror=implicit-function-declaration]
     892 |   ctrl_send = vzalloc(ctrl_send_size);
         |               ^~~~~~~
         |               kzalloc
   drivers/virtio/virtio_wl.c:892:13: warning: assignment to 'struct virtio_wl_ctrl_vfd_send *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     892 |   ctrl_send = vzalloc(ctrl_send_size);
         |             ^
>> drivers/virtio/virtio_wl.c:941:10: error: implicit declaration of function 'find_vm_area'; did you mean 'find_vma_prev'? [-Werror=implicit-function-declaration]
     941 |   area = find_vm_area(ctrl_send);
         |          ^~~~~~~~~~~~
         |          find_vma_prev
   drivers/virtio/virtio_wl.c:941:8: warning: assignment to 'struct vm_struct *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     941 |   area = find_vm_area(ctrl_send);
         |        ^
>> drivers/virtio/virtio_wl.c:942:45: error: dereferencing pointer to incomplete type 'struct vm_struct'
     942 |   ret = sg_alloc_table_from_pages(&sgt, area->pages,
         |                                             ^~
   cc1: some warnings being treated as errors


vim +892 drivers/virtio/virtio_wl.c

   788	
   789	static int virtwl_vfd_send(struct file *filp, const char __user *buffer,
   790						       u32 len, int *vfd_fds)
   791	{
   792		struct virtwl_vfd *vfd = filp->private_data;
   793		struct virtwl_info *vi = vfd->vi;
   794		struct fd vfd_files[VIRTWL_SEND_MAX_ALLOCS] = { { 0 } };
   795		struct virtwl_vfd *vfds[VIRTWL_SEND_MAX_ALLOCS] = { 0 };
   796	#ifdef SEND_VIRTGPU_RESOURCES
   797		struct dma_buf *virtgpu_dma_bufs[VIRTWL_SEND_MAX_ALLOCS] = { 0 };
   798		struct dma_fence *virtgpu_dma_fence[VIRTWL_SEND_MAX_ALLOCS] = { 0 };
   799		bool foreign_id = false;
   800	#endif
   801		size_t vfd_count = 0;
   802		size_t vfd_ids_size;
   803		size_t ctrl_send_size;
   804		struct virtio_wl_ctrl_vfd_send *ctrl_send;
   805		u8 *vfd_ids;
   806		u8 *out_buffer;
   807		struct completion finish_completion;
   808		struct scatterlist out_sg;
   809		struct scatterlist in_sg;
   810		struct sg_table sgt;
   811		struct vm_struct *area;
   812		bool vmalloced;
   813		int ret;
   814		int i;
   815	
   816		if (vfd_fds) {
   817			for (i = 0; i < VIRTWL_SEND_MAX_ALLOCS; i++) {
   818				struct fd vfd_file;
   819				int fd = vfd_fds[i];
   820	
   821				if (fd < 0)
   822					break;
   823	
   824				vfd_file = fdget(vfd_fds[i]);
   825				if (!vfd_file.file) {
   826					ret = -EBADFD;
   827					goto put_files;
   828				}
   829	
   830				if (vfd_file.file->f_op == &virtwl_vfd_fops) {
   831					vfd_files[i] = vfd_file;
   832	
   833					vfds[i] = vfd_file.file->private_data;
   834					if (vfds[i] && vfds[i]->id) {
   835						vfd_count++;
   836						continue;
   837					}
   838	
   839					ret = -EINVAL;
   840					goto put_files;
   841				} else {
   842					struct dma_buf *dma_buf = ERR_PTR(-EINVAL);
   843					struct dma_fence *dma_fence = ERR_PTR(-EINVAL);
   844					bool handled = false;
   845	
   846	#ifdef SEND_VIRTGPU_RESOURCES
   847					dma_buf = dma_buf_get(vfd_fds[i]);
   848					dma_fence = vi->use_send_vfd_v2
   849						? sync_file_get_fence(vfd_fds[i])
   850						: ERR_PTR(-EINVAL);
   851					handled = !IS_ERR(dma_buf) ||
   852						  !IS_ERR(dma_fence);
   853	
   854					if (!IS_ERR(dma_buf)) {
   855						virtgpu_dma_bufs[i] = dma_buf;
   856					} else {
   857						virtgpu_dma_fence[i] = dma_fence;
   858					}
   859	
   860					foreign_id = true;
   861					vfd_count++;
   862	#endif
   863					fdput(vfd_file);
   864					if (!handled) {
   865						ret = IS_ERR(dma_buf) ?
   866							PTR_ERR(dma_buf) :
   867							PTR_ERR(dma_fence);
   868						goto put_files;
   869					}
   870				}
   871			}
   872		}
   873	
   874		/* Empty writes always succeed. */
   875		if (len == 0 && vfd_count == 0)
   876			return 0;
   877	
   878		vfd_ids_size = vfd_count * sizeof(__le32);
   879	#ifdef SEND_VIRTGPU_RESOURCES
   880		if (foreign_id) {
   881			vfd_ids_size = vfd_count * (vi->use_send_vfd_v2
   882				? sizeof(struct virtio_wl_ctrl_vfd_send_vfd_v2)
   883				: sizeof(struct virtio_wl_ctrl_vfd_send_vfd));
   884		}
   885	#endif
   886		ctrl_send_size = sizeof(*ctrl_send) + vfd_ids_size + len;
   887		vmalloced = false;
   888		if (ctrl_send_size < PAGE_SIZE)
   889			ctrl_send = kzalloc(ctrl_send_size, GFP_KERNEL);
   890		else {
   891			vmalloced = true;
 > 892			ctrl_send = vzalloc(ctrl_send_size);
   893		}
   894		if (!ctrl_send) {
   895			ret = -ENOMEM;
   896			goto put_files;
   897		}
   898	
   899		vfd_ids = (u8 *)ctrl_send + sizeof(*ctrl_send);
   900		out_buffer = (u8 *)ctrl_send + ctrl_send_size - len;
   901	
   902		ctrl_send->hdr.type = VIRTIO_WL_CMD_VFD_SEND;
   903	#ifdef SEND_VIRTGPU_RESOURCES
   904		if (foreign_id) {
   905			struct virtio_wl_ctrl_vfd_send_vfd *v1 = NULL;
   906			struct virtio_wl_ctrl_vfd_send_vfd_v2 *v2 = NULL;
   907	
   908			if (vi->use_send_vfd_v2)
   909				v2 = (struct virtio_wl_ctrl_vfd_send_vfd_v2 *) vfd_ids;
   910			else
   911				v1 = (struct virtio_wl_ctrl_vfd_send_vfd *) vfd_ids;
   912	
   913			ctrl_send->hdr.type = VIRTIO_WL_CMD_VFD_SEND_FOREIGN_ID;
   914			ret = encode_vfd_ids_foreign(vfds,
   915				virtgpu_dma_bufs, virtgpu_dma_fence, vfd_count,
   916				v1, v2);
   917		} else {
   918			ret = encode_vfd_ids(vfds, vfd_count, (__le32 *)vfd_ids);
   919		}
   920	#else
   921		ret = encode_vfd_ids(vfds, vfd_count, (__le32 *)vfd_ids);
   922	#endif
   923		if (ret)
   924			goto free_ctrl_send;
   925		ctrl_send->vfd_id = vfd->id;
   926		ctrl_send->vfd_count = vfd_count;
   927	
   928		if (copy_from_user(out_buffer, buffer, len)) {
   929			ret = -EFAULT;
   930			goto free_ctrl_send;
   931		}
   932	
   933		init_completion(&finish_completion);
   934		if (!vmalloced) {
   935			sg_init_one(&out_sg, ctrl_send, ctrl_send_size);
   936			sg_init_one(&in_sg, ctrl_send,
   937			    sizeof(struct virtio_wl_ctrl_hdr));
   938			ret = vq_queue_out(vi, &out_sg, &in_sg, &finish_completion,
   939			    filp->f_flags & O_NONBLOCK);
   940		} else {
 > 941			area = find_vm_area(ctrl_send);
 > 942			ret = sg_alloc_table_from_pages(&sgt, area->pages,
   943			    area->nr_pages, 0, ctrl_send_size, GFP_KERNEL);
   944			if (ret)
   945				goto free_ctrl_send;
   946	
   947			sg_init_table(&in_sg, 1);
   948			sg_set_page(&in_sg, area->pages[0],
   949			    sizeof(struct virtio_wl_ctrl_hdr), 0);
   950	
   951			ret = vq_queue_out(vi, sgt.sgl, &in_sg, &finish_completion,
   952			    filp->f_flags & O_NONBLOCK);
   953		}
   954		if (ret)
   955			goto free_sgt;
   956	
   957		wait_for_completion(&finish_completion);
   958	
   959		ret = virtwl_resp_err(ctrl_send->hdr.type);
   960	
   961	free_sgt:
   962		if (vmalloced)
   963			sg_free_table(&sgt);
   964	free_ctrl_send:
   965		kvfree(ctrl_send);
   966	put_files:
   967		for (i = 0; i < VIRTWL_SEND_MAX_ALLOCS; i++) {
   968			if (vfd_files[i].file)
   969				fdput(vfd_files[i]);
   970	#ifdef SEND_VIRTGPU_RESOURCES
   971			if (virtgpu_dma_bufs[i])
   972				dma_buf_put(virtgpu_dma_bufs[i]);
   973			if (virtgpu_dma_fence[i])
   974				dma_fence_put(virtgpu_dma_fence[i]);
   975	#endif
   976		}
   977		return ret;
   978	}
   979	

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

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

only message in thread, other threads:[~2021-07-06 21:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-06 21:02 [chrome-os:chromeos-5.10 77/77] drivers/virtio/virtio_wl.c:892:15: error: implicit declaration of function 'vzalloc'; did you mean 'kzalloc'? 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.