Re: [PATCH] mm/damon/dbgfs: add region_stat interface

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

 



Hi Xin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on v5.15-rc5]
[cannot apply to hnaz-mm/master next-20211012]
[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/Xin-Hao/mm-damon-dbgfs-add-region_stat-interface/20211012-135023
base:    64570fbc14f8d7cb3fe3995f20e26bc25ce4b2cc
config: arm64-randconfig-r014-20211012 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c3dcf39554dbea780d6cb7e12239451ba47a2668)
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
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/0day-ci/linux/commit/256bdd48bd7719684cd8adbbda8a9df3dc9c1008
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Xin-Hao/mm-damon-dbgfs-add-region_stat-interface/20211012-135023
        git checkout 256bdd48bd7719684cd8adbbda8a9df3dc9c1008
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm64 

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

All warnings (new ones prefixed by >>):

>> mm/damon/dbgfs.c:311:3: warning: variable 'len' is uninitialized when used here [-Wuninitialized]
                   len += simple_read_from_buffer(buf, count, ppos, kbuf, written);
                   ^~~
   mm/damon/dbgfs.c:275:13: note: initialize the variable 'len' to silence this warning
           ssize_t len;
                      ^
                       = 0
   1 warning generated.


vim +/len +311 mm/damon/dbgfs.c

   268	
   269	static ssize_t dbgfs_region_stat_read(struct file *file,
   270			char __user *buf, size_t count, loff_t *ppos)
   271	{
   272		struct damon_ctx *ctx = file->private_data;
   273		struct damon_target *t;
   274		char *kbuf;
   275		ssize_t len;
   276		int id, rc, written = 0;
   277	
   278		kbuf = kmalloc(count, GFP_KERNEL);
   279		if (!kbuf)
   280			return -ENOMEM;
   281	
   282		mutex_lock(&ctx->kdamond_lock);
   283		damon_for_each_target(t, ctx) {
   284			struct damon_region *r;
   285	
   286			if (targetid_is_pid(ctx))
   287				id = (int)pid_vnr((struct pid *)t->id);
   288	
   289			rc = scnprintf(&kbuf[written], count - written,
   290					"last_aggregation=%lld.%lds\ntarget_id=%d\nnr_regions=%u\n",
   291					ctx->last_aggregation.tv_sec,
   292					ctx->last_aggregation.tv_nsec / 1000000,
   293					id, t->nr_regions);
   294			if (!rc)
   295				goto out;
   296	
   297			written += rc;
   298	
   299			damon_for_each_region(r, t) {
   300				rc = scnprintf(&kbuf[written], count - written,
   301					       "%lx-%lx(%lu KiB): %u\n",
   302					       r->ar.start, r->ar.end,
   303						   (r->ar.end - r->ar.start) >> 10,
   304						   r->nr_accesses);
   305				if (!rc)
   306					goto out;
   307	
   308				written += rc;
   309			}
   310	
 > 311			len += simple_read_from_buffer(buf, count, ppos, kbuf, written);
   312		}
   313	
   314	out:
   315		mutex_unlock(&ctx->kdamond_lock);
   316		kfree(kbuf);
   317		return len;
   318	}
   319	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux