All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: Re: [RFC PATCH 1/6] debugfs: fix automount d_fsdata usage
Date: Sat, 11 Nov 2023 07:12:39 +0800	[thread overview]
Message-ID: <202311110653.cItFLCy6-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20231109222251.9e54cb55c700.I64fe5615568e87f9ae2d7fb2ac4e5fa96924cb50@changeid>
References: <20231109222251.9e54cb55c700.I64fe5615568e87f9ae2d7fb2ac4e5fa96924cb50@changeid>
TO: Johannes Berg <johannes@sipsolutions.net>

Hi Johannes,

[This is a private test report for your RFC patch.]
kernel test robot noticed the following build warnings:

[auto build test WARNING on driver-core/driver-core-testing]
[also build test WARNING on driver-core/driver-core-next driver-core/driver-core-linus wireless-next/main wireless/main linus/master v6.6 next-20231110]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Johannes-Berg/debugfs-fix-automount-d_fsdata-usage/20231110-054024
base:   driver-core/driver-core-testing
patch link:    https://lore.kernel.org/r/20231109222251.9e54cb55c700.I64fe5615568e87f9ae2d7fb2ac4e5fa96924cb50%40changeid
patch subject: [RFC PATCH 1/6] debugfs: fix automount d_fsdata usage
:::::: branch date: 25 hours ago
:::::: commit date: 25 hours ago
config: i386-randconfig-141-20231111 (https://download.01.org/0day-ci/archive/20231111/202311110653.cItFLCy6-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231111/202311110653.cItFLCy6-lkp@intel.com/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 <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202311110653.cItFLCy6-lkp@intel.com/

New smatch warnings:
fs/debugfs/inode.c:655 debugfs_create_automount() warn: possible memory leak of 'fsd'

Old smatch warnings:
fs/debugfs/inode.c:662 debugfs_create_automount() warn: possible memory leak of 'fsd'

vim +/fsd +655 fs/debugfs/inode.c

^1da177e4c3f41 Linus Torvalds     2005-04-16  621  
77b3da6e3232d3 Al Viro            2015-01-25  622  /**
77b3da6e3232d3 Al Viro            2015-01-25  623   * debugfs_create_automount - create automount point in the debugfs filesystem
77b3da6e3232d3 Al Viro            2015-01-25  624   * @name: a pointer to a string containing the name of the file to create.
77b3da6e3232d3 Al Viro            2015-01-25  625   * @parent: a pointer to the parent dentry for this file.  This should be a
77b3da6e3232d3 Al Viro            2015-01-25  626   *          directory dentry if set.  If this parameter is NULL, then the
77b3da6e3232d3 Al Viro            2015-01-25  627   *          file will be created in the root of the debugfs filesystem.
77b3da6e3232d3 Al Viro            2015-01-25  628   * @f: function to be called when pathname resolution steps on that one.
77b3da6e3232d3 Al Viro            2015-01-25  629   * @data: opaque argument to pass to f().
77b3da6e3232d3 Al Viro            2015-01-25  630   *
77b3da6e3232d3 Al Viro            2015-01-25  631   * @f should return what ->d_automount() would.
77b3da6e3232d3 Al Viro            2015-01-25  632   */
77b3da6e3232d3 Al Viro            2015-01-25  633  struct dentry *debugfs_create_automount(const char *name,
77b3da6e3232d3 Al Viro            2015-01-25  634  					struct dentry *parent,
93faccbbfa958a Eric W. Biederman  2017-02-01  635  					debugfs_automount_t f,
77b3da6e3232d3 Al Viro            2015-01-25  636  					void *data)
77b3da6e3232d3 Al Viro            2015-01-25  637  {
77b3da6e3232d3 Al Viro            2015-01-25  638  	struct dentry *dentry = start_creating(name, parent);
3e1dead436f419 Johannes Berg      2023-11-09  639  	struct debugfs_fsdata *fsd;
77b3da6e3232d3 Al Viro            2015-01-25  640  	struct inode *inode;
77b3da6e3232d3 Al Viro            2015-01-25  641  
77b3da6e3232d3 Al Viro            2015-01-25  642  	if (IS_ERR(dentry))
ff9fb72bc07705 Greg Kroah-Hartman 2019-01-23  643  		return dentry;
77b3da6e3232d3 Al Viro            2015-01-25  644  
3e1dead436f419 Johannes Berg      2023-11-09  645  	fsd = kzalloc(sizeof(*fsd), GFP_KERNEL);
3e1dead436f419 Johannes Berg      2023-11-09  646  	if (!fsd) {
3e1dead436f419 Johannes Berg      2023-11-09  647  		failed_creating(dentry);
3e1dead436f419 Johannes Berg      2023-11-09  648  		return ERR_PTR(-ENOMEM);
3e1dead436f419 Johannes Berg      2023-11-09  649  	}
3e1dead436f419 Johannes Berg      2023-11-09  650  
3e1dead436f419 Johannes Berg      2023-11-09  651  	fsd->automount = f;
3e1dead436f419 Johannes Berg      2023-11-09  652  
a24c6f7bc923d5 Peter Enderborg    2020-07-16  653  	if (!(debugfs_allow & DEBUGFS_ALLOW_API)) {
a24c6f7bc923d5 Peter Enderborg    2020-07-16  654  		failed_creating(dentry);
a24c6f7bc923d5 Peter Enderborg    2020-07-16 @655  		return ERR_PTR(-EPERM);
a24c6f7bc923d5 Peter Enderborg    2020-07-16  656  	}
a24c6f7bc923d5 Peter Enderborg    2020-07-16  657  
77b3da6e3232d3 Al Viro            2015-01-25  658  	inode = debugfs_get_inode(dentry->d_sb);
43e23b6c0b0151 Greg Kroah-Hartman 2019-07-03  659  	if (unlikely(!inode)) {
43e23b6c0b0151 Greg Kroah-Hartman 2019-07-03  660  		pr_err("out of free dentries, can not create automount '%s'\n",
43e23b6c0b0151 Greg Kroah-Hartman 2019-07-03  661  		       name);
77b3da6e3232d3 Al Viro            2015-01-25  662  		return failed_creating(dentry);
43e23b6c0b0151 Greg Kroah-Hartman 2019-07-03  663  	}
77b3da6e3232d3 Al Viro            2015-01-25  664  
87243deb88671f Seth Forshee       2016-03-09  665  	make_empty_dir_inode(inode);
77b3da6e3232d3 Al Viro            2015-01-25  666  	inode->i_flags |= S_AUTOMOUNT;
77b3da6e3232d3 Al Viro            2015-01-25  667  	inode->i_private = data;
3e1dead436f419 Johannes Berg      2023-11-09  668  	dentry->d_fsdata = fsd;
a8f324a46fbe54 Roman Pen          2016-02-09  669  	/* directory inodes start off with i_nlink == 2 (for "." entry) */
a8f324a46fbe54 Roman Pen          2016-02-09  670  	inc_nlink(inode);
77b3da6e3232d3 Al Viro            2015-01-25  671  	d_instantiate(dentry, inode);
a8f324a46fbe54 Roman Pen          2016-02-09  672  	inc_nlink(d_inode(dentry->d_parent));
a8f324a46fbe54 Roman Pen          2016-02-09  673  	fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
77b3da6e3232d3 Al Viro            2015-01-25  674  	return end_creating(dentry);
77b3da6e3232d3 Al Viro            2015-01-25  675  }
77b3da6e3232d3 Al Viro            2015-01-25  676  EXPORT_SYMBOL(debugfs_create_automount);
77b3da6e3232d3 Al Viro            2015-01-25  677  

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

             reply	other threads:[~2023-11-10 23:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-10 23:12 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-11-09 21:22 [RFC PATCH 0/6] debugfs/wifi: locking fixes Johannes Berg
2023-11-09 21:22 ` [RFC PATCH 1/6] debugfs: fix automount d_fsdata usage Johannes Berg
2023-11-20 11:31   ` Dan Carpenter

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=202311110653.cItFLCy6-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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.