All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [amir73il:ovl_real_file 2/4] fs/overlayfs/file.c:139:23: sparse: sparse: Using plain integer as NULL pointer
Date: Sun, 6 Oct 2024 08:40:47 +0800	[thread overview]
Message-ID: <202410060829.UTwmlmcr-lkp@intel.com> (raw)

tree:   https://github.com/amir73il/linux ovl_real_file
head:   2e6c8d603136baf0de510ba069ad78a449012807
commit: e37f0a8ea49c2287a7c722abb1d4d97619bc7271 [2/4] ovl: stash upper real file in backing_file struct
config: hexagon-randconfig-r113-20241005 (https://download.01.org/0day-ci/archive/20241006/202410060829.UTwmlmcr-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project fef3566a25ff0e34fb87339ba5e13eca17cec00f)
reproduce: (https://download.01.org/0day-ci/archive/20241006/202410060829.UTwmlmcr-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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410060829.UTwmlmcr-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> fs/overlayfs/file.c:139:23: sparse: sparse: Using plain integer as NULL pointer

vim +139 fs/overlayfs/file.c

    93	
    94	static int ovl_real_fdget_meta(const struct file *file, struct fd *real,
    95				       bool upper_meta)
    96	{
    97		struct dentry *dentry = file_dentry(file);
    98		struct file *realfile = file->private_data;
    99		struct file *upperfile = backing_file_private(realfile);
   100		struct path realpath;
   101		int err;
   102	
   103		real->word = 0;
   104	
   105		if (upper_meta) {
   106			ovl_path_upper(dentry, &realpath);
   107			if (!realpath.dentry)
   108				return 0;
   109		} else {
   110			/* lazy lookup and verify of lowerdata */
   111			err = ovl_verify_lowerdata(dentry);
   112			if (err)
   113				return err;
   114	
   115			ovl_path_realdata(dentry, &realpath);
   116		}
   117		if (!realpath.dentry)
   118			return -EIO;
   119	
   120	stashed_upper:
   121		if (upperfile && file_inode(upperfile) == d_inode(realpath.dentry))
   122			realfile = upperfile;
   123	
   124		/*
   125		 * If realfile is lower and has been copied up since we'd opened it,
   126		 * open the real upper file and stash it in backing_file_private().
   127		 */
   128		if (unlikely(file_inode(realfile) != d_inode(realpath.dentry))) {
   129			struct file *old;
   130	
   131			/* Stashed upperfile has a mismatched inode */
   132			if (unlikely(upperfile))
   133				return -EIO;
   134	
   135			upperfile = ovl_open_realfile(file, &realpath);
   136			if (IS_ERR(upperfile))
   137				return PTR_ERR(upperfile);
   138	
 > 139			old = cmpxchg_release(backing_file_private_ptr(realfile), NULL,
   140					      upperfile);
   141			if (old) {
   142				fput(upperfile);
   143				upperfile = old;
   144			}
   145	
   146			goto stashed_upper;
   147		}
   148	
   149		real->word = (unsigned long)realfile;
   150	
   151		/* Did the flags change since open? */
   152		if (unlikely((file->f_flags ^ realfile->f_flags) & ~OVL_OPEN_FLAGS))
   153			return ovl_change_flags(realfile, file->f_flags);
   154	
   155		return 0;
   156	}
   157	

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

                 reply	other threads:[~2024-10-06  0:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202410060829.UTwmlmcr-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=amir73il@gmail.com \
    --cc=oe-kbuild-all@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.