Re: [PATCH v1] proc: limit schedstate node write operation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Junwen,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on hnaz-mm/master]
[also build test WARNING on kees/for-next/pstore linus/master linux/master v5.18-rc3 next-20220422]
[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/intel-lab-lkp/linux/commits/Junwen-Wu/proc-limit-schedstate-node-write-operation/20220423-103457
base:   https://github.com/hnaz/linux-mm master
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20220423/202204231250.LYIILAXn-lkp@xxxxxxxxx/config)
compiler: alpha-linux-gcc (GCC) 11.2.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/intel-lab-lkp/linux/commit/e7bc039b7c0aa4e9a5bb3ae2340769a451f795db
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Junwen-Wu/proc-limit-schedstate-node-write-operation/20220423-103457
        git checkout e7bc039b7c0aa4e9a5bb3ae2340769a451f795db
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross W=1 O=build_dir ARCH=alpha SHELL=/bin/bash fs/

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

All warnings (new ones prefixed by >>):

   fs/proc/base.c: In function 'sched_write':
>> fs/proc/base.c:1468:13: warning: 'strcmp' of a string of length 5 and an array of size 5 evaluates to nonzero [-Wstring-compare]
    1468 |         if (strcmp(ubuf, "reset") == 0) {
         |             ^~~~~~~~~~~~~~~~~~~~~


vim +/strcmp +1468 fs/proc/base.c

  1454	
  1455	static ssize_t
  1456	sched_write(struct file *file, const char __user *buf,
  1457		    size_t count, loff_t *offset)
  1458	{
  1459		struct inode *inode = file_inode(file);
  1460		struct task_struct *p;
  1461		char ubuf[5];
  1462	
  1463		memset(ubuf, 0, sizeof(ubuf));
  1464		if (count > 5)
  1465			count = 0;
  1466		if (copy_from_user(ubuf, buf, count))
  1467			return -EFAULT;
> 1468		if (strcmp(ubuf, "reset") == 0) {
  1469			p = get_proc_task(inode);
  1470			if (!p)
  1471				return -ESRCH;
  1472			proc_sched_set_task(p);
  1473	
  1474			put_task_struct(p);
  1475		}
  1476	
  1477		return count;
  1478	}
  1479	

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



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux