All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Mateusz Guzik <mjguzik@gmail.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>
Subject: fs/file_table.c:241:13: sparse: sparse: cast truncates bits from constant value (123456789abcdef becomes 89abcdef)
Date: Thu, 16 Jul 2026 17:13:31 +0800	[thread overview]
Message-ID: <202607161708.OwceDeuL-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   58717b2a1365d06c8c64b72aa948541b53fe31eb
commit: 1f1651d6dc2ac282d07043358824273c15a1cac4 fs: hide file and bfile caches behind runtime const machinery
date:   4 months ago
config: i386-randconfig-061-20260716 (https://download.01.org/0day-ci/archive/20260716/202607161708.OwceDeuL-lkp@intel.com/config)
compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260716/202607161708.OwceDeuL-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
| Fixes: 1f1651d6dc2a ("fs: hide file and bfile caches behind runtime const machinery")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607161708.OwceDeuL-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> fs/file_table.c:241:13: sparse: sparse: cast truncates bits from constant value (123456789abcdef becomes 89abcdef)
>> fs/file_table.c:241:13: sparse: sparse: cast truncates bits from constant value (123456789abcdef becomes 89abcdef)
   fs/file_table.c:247:33: sparse: sparse: cast truncates bits from constant value (123456789abcdef becomes 89abcdef)
   fs/file_table.c:275:13: sparse: sparse: cast truncates bits from constant value (123456789abcdef becomes 89abcdef)
   fs/file_table.c:275:13: sparse: sparse: cast truncates bits from constant value (123456789abcdef becomes 89abcdef)
   fs/file_table.c:281:33: sparse: sparse: cast truncates bits from constant value (123456789abcdef becomes 89abcdef)
   fs/file_table.c:302:14: sparse: sparse: cast truncates bits from constant value (123456789abcdef becomes 89abcdef)
   fs/file_table.c:302:14: sparse: sparse: cast truncates bits from constant value (123456789abcdef becomes 89abcdef)
   fs/file_table.c:308:33: sparse: sparse: cast truncates bits from constant value (123456789abcdef becomes 89abcdef)
   fs/file_table.c:81:33: sparse: sparse: cast truncates bits from constant value (123456789abcdef becomes 89abcdef)
   fs/file_table.c:83:33: sparse: sparse: cast truncates bits from constant value (123456789abcdef becomes 89abcdef)

vim +241 fs/file_table.c

   211	
   212	/* Find an unused file structure and return a pointer to it.
   213	 * Returns an error pointer if some error happend e.g. we over file
   214	 * structures limit, run out of memory or operation is not permitted.
   215	 *
   216	 * Be very careful using this.  You are responsible for
   217	 * getting write access to any mount that you might assign
   218	 * to this filp, if it is opened for write.  If this is not
   219	 * done, you will imbalance int the mount's writer count
   220	 * and a warning at __fput() time.
   221	 */
   222	struct file *alloc_empty_file(int flags, const struct cred *cred)
   223	{
   224		static long old_max;
   225		struct file *f;
   226		int error;
   227	
   228		/*
   229		 * Privileged users can go above max_files
   230		 */
   231		if (unlikely(get_nr_files() >= files_stat.max_files) &&
   232		    !capable(CAP_SYS_ADMIN)) {
   233			/*
   234			 * percpu_counters are inaccurate.  Do an expensive check before
   235			 * we go and fail.
   236			 */
   237			if (percpu_counter_sum_positive(&nr_files) >= files_stat.max_files)
   238				goto over;
   239		}
   240	
 > 241		f = kmem_cache_alloc(filp_cache, GFP_KERNEL);
   242		if (unlikely(!f))
   243			return ERR_PTR(-ENOMEM);
   244	
   245		error = init_file(f, flags, cred);
   246		if (unlikely(error)) {
   247			kmem_cache_free(filp_cache, f);
   248			return ERR_PTR(error);
   249		}
   250	
   251		percpu_counter_inc(&nr_files);
   252	
   253		return f;
   254	
   255	over:
   256		/* Ran out of filps - report that */
   257		if (get_nr_files() > old_max) {
   258			pr_info("VFS: file-max limit %lu reached\n", get_max_files());
   259			old_max = get_nr_files();
   260		}
   261		return ERR_PTR(-ENFILE);
   262	}
   263	

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

             reply	other threads:[~2026-07-16  9:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16  9:13 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-05-07 10:54 fs/file_table.c:241:13: sparse: sparse: cast truncates bits from constant value (123456789abcdef becomes 89abcdef) 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=202607161708.OwceDeuL-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjguzik@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.