Re: [PATCH] uacce: Add uacce_ctrl misc device

From: kernel test robot
Date: Thu Jan 21 2021 - 12:19:20 EST


Hi Zhou,

I love your patch! Yet something to improve:

[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on soc/for-next linux/master linus/master v5.11-rc4 next-20210121]
[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]

url: https://github.com/0day-ci/linux/commits/Zhou-Wang/uacce-Add-uacce_ctrl-misc-device/20210121-172139
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git f6f1f8e6e3eea25f539105d48166e91f0ab46dd1
config: alpha-randconfig-p002-20210121 (attached as .config)
compiler: alpha-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/0day-ci/linux/commit/4dc40d891a7e60ed79e6b9460a38a142d3d1a965
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Zhou-Wang/uacce-Add-uacce_ctrl-misc-device/20210121-172139
git checkout 4dc40d891a7e60ed79e6b9460a38a142d3d1a965
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha

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

All error/warnings (new ones prefixed by >>):

drivers/misc/uacce/uacce.c:511:5: warning: no previous prototype for 'uacce_ctrl_open' [-Wmissing-prototypes]
511 | int uacce_ctrl_open(struct inode *inode, struct file *file)
| ^~~~~~~~~~~~~~~
drivers/misc/uacce/uacce.c:525:5: warning: no previous prototype for 'uacce_ctrl_release' [-Wmissing-prototypes]
525 | int uacce_ctrl_release(struct inode *inode, struct file *file)
| ^~~~~~~~~~~~~~~~~~
drivers/misc/uacce/uacce.c: In function 'uacce_ctrl_release':
>> drivers/misc/uacce/uacce.c:534:3: error: implicit declaration of function 'vfree'; did you mean 'kfree'? [-Werror=implicit-function-declaration]
534 | vfree(p->pages);
| ^~~~~
| kfree
drivers/misc/uacce/uacce.c: In function 'uacce_pin_page':
>> drivers/misc/uacce/uacce.c:557:10: error: implicit declaration of function 'vmalloc'; did you mean 'kmalloc'? [-Werror=implicit-function-declaration]
557 | pages = vmalloc(nr_pages * sizeof(struct page *));
| ^~~~~~~
| kmalloc
>> drivers/misc/uacce/uacce.c:557:8: warning: assignment to 'struct page **' from 'int' makes pointer from integer without a cast [-Wint-conversion]
557 | pages = vmalloc(nr_pages * sizeof(struct page *));
| ^
drivers/misc/uacce/uacce.c: In function 'uacce_ctrl_unl_ioctl':
drivers/misc/uacce/uacce.c:626:6: warning: unused variable 'ret' [-Wunused-variable]
626 | int ret;
| ^~~
cc1: some warnings being treated as errors


vim +534 drivers/misc/uacce/uacce.c

524
525 int uacce_ctrl_release(struct inode *inode, struct file *file)
526 {
527 struct uacce_pin_container *priv = file->private_data;
528 struct pin_pages *p;
529 unsigned long idx;
530
531 xa_for_each(&priv->array, idx, p) {
532 unpin_user_pages(p->pages, p->nr_pages);
533 xa_erase(&priv->array, p->first);
> 534 vfree(p->pages);
535 kfree(p);
536 }
537
538 xa_destroy(&priv->array);
539 kfree(priv);
540
541 return 0;
542 }
543
544 static int uacce_pin_page(struct uacce_pin_container *priv,
545 struct uacce_pin_address *addr)
546 {
547 unsigned int flags = FOLL_FORCE | FOLL_WRITE;
548 unsigned long first, last, nr_pages;
549 struct page **pages;
550 struct pin_pages *p;
551 int ret;
552
553 first = (addr->addr & PAGE_MASK) >> PAGE_SHIFT;
554 last = ((addr->addr + addr->size - 1) & PAGE_MASK) >> PAGE_SHIFT;
555 nr_pages = last - first + 1;
556
> 557 pages = vmalloc(nr_pages * sizeof(struct page *));
558 if (!pages)
559 return -ENOMEM;
560
561 p = kzalloc(sizeof(*p), GFP_KERNEL);
562 if (!p) {
563 ret = -ENOMEM;
564 goto free;
565 }
566
567 ret = pin_user_pages_fast(addr->addr & PAGE_MASK, nr_pages,
568 flags | FOLL_LONGTERM, pages);
569 if (ret != nr_pages) {
570 pr_err("uacce: Failed to pin page\n");
571 goto free_p;
572 }
573 p->first = first;
574 p->nr_pages = nr_pages;
575 p->pages = pages;
576
577 ret = xa_err(xa_store(&priv->array, p->first, p, GFP_KERNEL));
578 if (ret)
579 goto unpin_pages;
580
581 return 0;
582
583 unpin_pages:
584 unpin_user_pages(pages, nr_pages);
585 free_p:
586 kfree(p);
587 free:
588 vfree(pages);
589 return ret;
590 }
591

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip