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: [chrome-os:chromeos-6.1 36/42] fs/configfs/inode.c:189 configfs_create() error: we previously assumed 'sd_parent' could be null (see line 182)
Date: Fri, 11 Aug 2023 09:15:10 +0800	[thread overview]
Message-ID: <202308110932.apiJRvXa-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: cros-kernel-buildreports@googlegroups.com
TO: Guenter Roeck <groeck@google.com>

tree:   https://chromium.googlesource.com/chromiumos/third_party/kernel chromeos-6.1
head:   49642342732c55841e454f874f36062a1a64e0dd
commit: 6570cb0654b65ea2dbe52c1c0f2590e338d9ab7e [36/42] FIXUP: CHROMIUM: configfs: inherit file and directory owners
:::::: branch date: 6 hours ago
:::::: commit date: 25 hours ago
config: arc-randconfig-m041-20230811 (https://download.01.org/0day-ci/archive/20230811/202308110932.apiJRvXa-lkp@intel.com/config)
compiler: arceb-elf-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230811/202308110932.apiJRvXa-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/202308110932.apiJRvXa-lkp@intel.com/

smatch warnings:
fs/configfs/inode.c:189 configfs_create() error: we previously assumed 'sd_parent' could be null (see line 182)

vim +/sd_parent +189 fs/configfs/inode.c

e74cc06df3b05e Louis Rilling    2009-01-28  156  
2743c515a1239b Al Viro          2019-09-11  157  struct inode *configfs_create(struct dentry *dentry, umode_t mode)
7063fbf2261194 Joel Becker      2005-12-15  158  {
7063fbf2261194 Joel Becker      2005-12-15  159  	struct inode *inode = NULL;
16d13b59b5b85e Al Viro          2012-03-17  160  	struct configfs_dirent *sd;
16d13b59b5b85e Al Viro          2012-03-17  161  	struct inode *p_inode;
e5e090ca97600b Daniel Rosenberg 2018-03-15  162  	struct dentry *parent;
16d13b59b5b85e Al Viro          2012-03-17  163  
16d13b59b5b85e Al Viro          2012-03-17  164  	if (!dentry)
2743c515a1239b Al Viro          2019-09-11  165  		return ERR_PTR(-ENOENT);
16d13b59b5b85e Al Viro          2012-03-17  166  
2b0143b5c986be David Howells    2015-03-17  167  	if (d_really_is_positive(dentry))
2743c515a1239b Al Viro          2019-09-11  168  		return ERR_PTR(-EEXIST);
16d13b59b5b85e Al Viro          2012-03-17  169  
16d13b59b5b85e Al Viro          2012-03-17  170  	sd = dentry->d_fsdata;
e5e090ca97600b Daniel Rosenberg 2018-03-15  171  	parent = dget_parent(dentry);
e5e090ca97600b Daniel Rosenberg 2018-03-15  172  	if (parent && !sd->s_iattr) {
6570cb0654b65e Tzung-Bi Shih    2023-08-09  173  		struct configfs_dirent *sd_parent = parent->d_fsdata;
6570cb0654b65e Tzung-Bi Shih    2023-08-09  174  
6570cb0654b65e Tzung-Bi Shih    2023-08-09  175  		sd->s_iattr = kzalloc(sizeof(struct iattr), GFP_KERNEL);
36caf34d422a0c Tzung-Bi Shih    2023-08-09  176  		if (!sd->s_iattr) {
36caf34d422a0c Tzung-Bi Shih    2023-08-09  177  			dput(parent);
e5e090ca97600b Daniel Rosenberg 2018-03-15  178  			return ERR_PTR(-ENOMEM);
e5e090ca97600b Daniel Rosenberg 2018-03-15  179  		}
6570cb0654b65e Tzung-Bi Shih    2023-08-09  180  
6570cb0654b65e Tzung-Bi Shih    2023-08-09  181  		sd->s_iattr->ia_mode = sd->s_mode;
6570cb0654b65e Tzung-Bi Shih    2023-08-09 @182  		if (sd_parent && sd_parent->s_iattr) {
6570cb0654b65e Tzung-Bi Shih    2023-08-09  183  			sd->s_iattr->ia_uid = sd_parent->s_iattr->ia_uid;
6570cb0654b65e Tzung-Bi Shih    2023-08-09  184  			sd->s_iattr->ia_gid = sd_parent->s_iattr->ia_gid;
6570cb0654b65e Tzung-Bi Shih    2023-08-09  185  		} else {
6570cb0654b65e Tzung-Bi Shih    2023-08-09  186  			sd->s_iattr->ia_uid = GLOBAL_ROOT_UID;
6570cb0654b65e Tzung-Bi Shih    2023-08-09  187  			sd->s_iattr->ia_gid = GLOBAL_ROOT_GID;
6570cb0654b65e Tzung-Bi Shih    2023-08-09  188  		}
6570cb0654b65e Tzung-Bi Shih    2023-08-09 @189  		if (sd_parent->s_dentry && d_inode(sd_parent->s_dentry))
6570cb0654b65e Tzung-Bi Shih    2023-08-09  190  			sd->s_iattr->ia_ctime = current_time(d_inode(sd_parent->s_dentry));
6570cb0654b65e Tzung-Bi Shih    2023-08-09  191  		else
6570cb0654b65e Tzung-Bi Shih    2023-08-09  192  			ktime_get_coarse_real_ts64(&sd->s_iattr->ia_ctime);
6570cb0654b65e Tzung-Bi Shih    2023-08-09  193  		sd->s_iattr->ia_atime = sd->s_iattr->ia_mtime = sd->s_iattr->ia_ctime;
36caf34d422a0c Tzung-Bi Shih    2023-08-09  194  	}
e5e090ca97600b Daniel Rosenberg 2018-03-15  195  	dput(parent);
16d13b59b5b85e Al Viro          2012-03-17  196  	inode = configfs_new_inode(mode, sd, dentry->d_sb);
16d13b59b5b85e Al Viro          2012-03-17  197  	if (!inode)
2743c515a1239b Al Viro          2019-09-11  198  		return ERR_PTR(-ENOMEM);
16d13b59b5b85e Al Viro          2012-03-17  199  
2b0143b5c986be David Howells    2015-03-17  200  	p_inode = d_inode(dentry->d_parent);
c2050a454c7f12 Deepa Dinamani   2016-09-14  201  	p_inode->i_mtime = p_inode->i_ctime = current_time(p_inode);
e74cc06df3b05e Louis Rilling    2009-01-28  202  	configfs_set_inode_lock_class(sd, inode);
2743c515a1239b Al Viro          2019-09-11  203  	return inode;
7063fbf2261194 Joel Becker      2005-12-15  204  }
7063fbf2261194 Joel Becker      2005-12-15  205  

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

             reply	other threads:[~2023-08-11  1:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-11  1:15 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-08-11  5:22 [chrome-os:chromeos-6.1 36/42] fs/configfs/inode.c:189 configfs_create() error: we previously assumed 'sd_parent' could be null (see line 182) 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=202308110932.apiJRvXa-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.