All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [hnaz-mm:master 280/435] mm/damon/dbgfs.c:227 dbgfs_schemes_write() warn: passing a valid pointer to 'PTR_ERR'
Date: Fri, 12 Nov 2021 05:35:20 +0800	[thread overview]
Message-ID: <202111120511.ZjIrjzZu-lkp@intel.com> (raw)

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

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: SeongJae Park <sj@kernel.org>
CC: Johannes Weiner <hannes@cmpxchg.org>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>

tree:   https://github.com/hnaz/linux-mm master
head:   b8280145cf2a894c873fdf91fb2af474c52ac6cc
commit: 82bb324ecd8be8ea94ab8d578b326f7de65c122c [280/435] mm/damon/dbgfs: support DAMON-based Operation Schemes
:::::: branch date: 2 weeks ago
:::::: commit date: 2 weeks ago
config: microblaze-randconfig-m031-20211104 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 11.2.0

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

smatch warnings:
mm/damon/dbgfs.c:227 dbgfs_schemes_write() warn: passing a valid pointer to 'PTR_ERR'

vim +/PTR_ERR +227 mm/damon/dbgfs.c

82bb324ecd8be8 SeongJae Park 2021-10-28  215  
82bb324ecd8be8 SeongJae Park 2021-10-28  216  static ssize_t dbgfs_schemes_write(struct file *file, const char __user *buf,
82bb324ecd8be8 SeongJae Park 2021-10-28  217  		size_t count, loff_t *ppos)
82bb324ecd8be8 SeongJae Park 2021-10-28  218  {
82bb324ecd8be8 SeongJae Park 2021-10-28  219  	struct damon_ctx *ctx = file->private_data;
82bb324ecd8be8 SeongJae Park 2021-10-28  220  	char *kbuf;
82bb324ecd8be8 SeongJae Park 2021-10-28  221  	struct damos **schemes;
82bb324ecd8be8 SeongJae Park 2021-10-28  222  	ssize_t nr_schemes = 0, ret = count;
82bb324ecd8be8 SeongJae Park 2021-10-28  223  	int err;
82bb324ecd8be8 SeongJae Park 2021-10-28  224  
82bb324ecd8be8 SeongJae Park 2021-10-28  225  	kbuf = user_input_str(buf, count, ppos);
82bb324ecd8be8 SeongJae Park 2021-10-28  226  	if (IS_ERR(kbuf))
82bb324ecd8be8 SeongJae Park 2021-10-28 @227  		return PTR_ERR(kbuf);
82bb324ecd8be8 SeongJae Park 2021-10-28  228  
82bb324ecd8be8 SeongJae Park 2021-10-28  229  	schemes = str_to_schemes(kbuf, ret, &nr_schemes);
82bb324ecd8be8 SeongJae Park 2021-10-28  230  	if (!schemes) {
82bb324ecd8be8 SeongJae Park 2021-10-28  231  		ret = -EINVAL;
82bb324ecd8be8 SeongJae Park 2021-10-28  232  		goto out;
82bb324ecd8be8 SeongJae Park 2021-10-28  233  	}
82bb324ecd8be8 SeongJae Park 2021-10-28  234  
82bb324ecd8be8 SeongJae Park 2021-10-28  235  	mutex_lock(&ctx->kdamond_lock);
82bb324ecd8be8 SeongJae Park 2021-10-28  236  	if (ctx->kdamond) {
82bb324ecd8be8 SeongJae Park 2021-10-28  237  		ret = -EBUSY;
82bb324ecd8be8 SeongJae Park 2021-10-28  238  		goto unlock_out;
82bb324ecd8be8 SeongJae Park 2021-10-28  239  	}
82bb324ecd8be8 SeongJae Park 2021-10-28  240  
82bb324ecd8be8 SeongJae Park 2021-10-28  241  	err = damon_set_schemes(ctx, schemes, nr_schemes);
82bb324ecd8be8 SeongJae Park 2021-10-28  242  	if (err)
82bb324ecd8be8 SeongJae Park 2021-10-28  243  		ret = err;
82bb324ecd8be8 SeongJae Park 2021-10-28  244  	else
82bb324ecd8be8 SeongJae Park 2021-10-28  245  		nr_schemes = 0;
82bb324ecd8be8 SeongJae Park 2021-10-28  246  unlock_out:
82bb324ecd8be8 SeongJae Park 2021-10-28  247  	mutex_unlock(&ctx->kdamond_lock);
82bb324ecd8be8 SeongJae Park 2021-10-28  248  	free_schemes_arr(schemes, nr_schemes);
82bb324ecd8be8 SeongJae Park 2021-10-28  249  out:
82bb324ecd8be8 SeongJae Park 2021-10-28  250  	kfree(kbuf);
82bb324ecd8be8 SeongJae Park 2021-10-28  251  	return ret;
82bb324ecd8be8 SeongJae Park 2021-10-28  252  }
82bb324ecd8be8 SeongJae Park 2021-10-28  253  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34682 bytes --]

             reply	other threads:[~2021-11-11 21:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 21:35 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-11-06  6:07 [hnaz-mm:master 280/435] mm/damon/dbgfs.c:227 dbgfs_schemes_write() warn: passing a valid pointer to 'PTR_ERR' kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202111120511.ZjIrjzZu-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.