Subject: Re: [net-next v2 3/4] eventpoll: Add epoll ioctl for epoll_params

From: kernel test robot <[email-masked]>
Date: Thu, 25 Jan 2024 21:12:35 +0800

Hi Joe,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Joe-Damato/eventpoll-support-busy-poll-per-epoll-instance/20240125-083418
base:   net-next/main
patch link:    https://lore.kernel.org/r/20240125003014.43103-4-jdamato%40fastly.com
patch subject: [net-next v2 3/4] eventpoll: Add epoll ioctl for epoll_params
config: openrisc-allnoconfig (https://download.01.org/0day-ci/archive/20240125/[email-masked]/config)
compiler: or1k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240125/[email-masked]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email-masked]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email-masked]/

All warnings (new ones prefixed by >>):

   fs/eventpoll.c: In function 'ep_eventpoll_ioctl':
>> fs/eventpoll.c:879:22: warning: unused variable 'uarg' [-Wunused-variable]
     879 |         void __user *uarg = (void __user *) arg;
         |                      ^~~~
>> fs/eventpoll.c:878:29: warning: unused variable 'epoll_params' [-Wunused-variable]
     878 |         struct epoll_params epoll_params;
         |                             ^~~~~~~~~~~~
   fs/eventpoll.c:877:27: warning: variable 'ep' set but not used [-Wunused-but-set-variable]
     877 |         struct eventpoll *ep;
         |                           ^~

vim +/uarg +879 fs/eventpoll.c

   873	
   874	static long ep_eventpoll_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
   875	{
   876		int ret;
   877		struct eventpoll *ep;
 > 878		struct epoll_params epoll_params;
 > 879		void __user *uarg = (void __user *) arg;
   880	
   881		if (!is_file_epoll(file))
   882			return -EINVAL;
   883	
   884		ep = file->private_data;
   885	
   886		switch (cmd) {
   887	#ifdef CONFIG_NET_RX_BUSY_POLL
   888		case EPIOCSPARAMS:
   889			if (copy_from_user(&epoll_params, uarg, sizeof(epoll_params)))
   890				return -EFAULT;
   891	
   892			if (epoll_params.busy_poll_budget > NAPI_POLL_WEIGHT)
   893				pr_err("busy poll budget %u exceeds suggested maximum %u\n",
   894						epoll_params.busy_poll_budget, NAPI_POLL_WEIGHT);
   895	
   896			ep->busy_poll_usecs = epoll_params.busy_poll_usecs;
   897			ep->busy_poll_budget = epoll_params.busy_poll_budget;
   898			return 0;
   899	
   900		case EPIOCGPARAMS:
   901			memset(&epoll_params, 0, sizeof(epoll_params));
   902			epoll_params.busy_poll_usecs = ep->busy_poll_usecs;
   903			epoll_params.busy_poll_budget = ep->busy_poll_budget;
   904			if (copy_to_user(uarg, &epoll_params, sizeof(epoll_params)))
   905				return -EFAULT;
   906	
   907			return 0;
   908	#endif
   909		default:
   910			ret = -EINVAL;
   911			break;
   912		}
   913	
   914		return ret;
   915	}
   916	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki