All of lore.kernel.org
 help / color / mirror / Atom feed
* [android-common:android15-6.6-2025-02 2/2] mm/filemap.c:1933:60: sparse: sparse: incorrect type in argument 3 (different base types)
@ 2025-07-22 11:43 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-07-22 11:43 UTC (permalink / raw)
  To: cros-kernel-buildreports; +Cc: oe-kbuild-all

tree:   https://android.googlesource.com/kernel/common android15-6.6-2025-02
head:   d0c43a640eabd158f426e314f7bf2019a4f3e102
commit: cbac5cbf85540c043d1ddb917f288ebfe62bbca7 [2/2] ANDROID: mm: Add vendor hook in filemap_get_folio()
config: i386-randconfig-r121-20250722 (https://download.01.org/0day-ci/archive/20250722/202507221930.U3treVDS-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250722/202507221930.U3treVDS-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/202507221930.U3treVDS-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> mm/filemap.c:1933:60: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected int fgp_flags @@     got restricted fgf_t [usertype] fgp_flags @@
   mm/filemap.c:1933:60: sparse:     expected int fgp_flags
   mm/filemap.c:1933:60: sparse:     got restricted fgf_t [usertype] fgp_flags
   mm/filemap.c: note: in included file (through include/linux/rculist.h, include/linux/dcache.h, include/linux/fs.h, include/linux/dax.h):
   include/linux/rcupdate.h:815:9: sparse: sparse: context imbalance in 'filemap_map_pages' - different lock contexts for basic block

vim +1933 mm/filemap.c

  1907	
  1908	/**
  1909	 * __filemap_get_folio - Find and get a reference to a folio.
  1910	 * @mapping: The address_space to search.
  1911	 * @index: The page index.
  1912	 * @fgp_flags: %FGP flags modify how the folio is returned.
  1913	 * @gfp: Memory allocation flags to use if %FGP_CREAT is specified.
  1914	 *
  1915	 * Looks up the page cache entry at @mapping & @index.
  1916	 *
  1917	 * If %FGP_LOCK or %FGP_CREAT are specified then the function may sleep even
  1918	 * if the %GFP flags specified for %FGP_CREAT are atomic.
  1919	 *
  1920	 * If this function returns a folio, it is returned with an increased refcount.
  1921	 *
  1922	 * Return: The found folio or an ERR_PTR() otherwise.
  1923	 */
  1924	struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index,
  1925			fgf_t fgp_flags, gfp_t gfp)
  1926	{
  1927		struct folio *folio;
  1928	
  1929	repeat:
  1930		folio = filemap_get_entry(mapping, index);
  1931		if (xa_is_value(folio))
  1932			folio = NULL;
> 1933		trace_android_vh_filemap_get_folio(mapping, index, fgp_flags,
  1934						gfp, folio);
  1935		if (!folio)
  1936			goto no_page;
  1937	
  1938		if (fgp_flags & FGP_LOCK) {
  1939			if (fgp_flags & FGP_NOWAIT) {
  1940				if (!folio_trylock(folio)) {
  1941					folio_put(folio);
  1942					return ERR_PTR(-EAGAIN);
  1943				}
  1944			} else {
  1945				folio_lock(folio);
  1946			}
  1947	
  1948			/* Has the page been truncated? */
  1949			if (unlikely(folio->mapping != mapping)) {
  1950				folio_unlock(folio);
  1951				folio_put(folio);
  1952				goto repeat;
  1953			}
  1954			VM_BUG_ON_FOLIO(!folio_contains(folio, index), folio);
  1955		}
  1956	
  1957		if (fgp_flags & FGP_ACCESSED)
  1958			folio_mark_accessed(folio);
  1959		else if (fgp_flags & FGP_WRITE) {
  1960			/* Clear idle flag for buffer write */
  1961			if (folio_test_idle(folio))
  1962				folio_clear_idle(folio);
  1963		}
  1964	
  1965		if (fgp_flags & FGP_STABLE)
  1966			folio_wait_stable(folio);
  1967	no_page:
  1968		if (!folio && (fgp_flags & FGP_CREAT)) {
  1969			unsigned order = FGF_GET_ORDER(fgp_flags);
  1970			int err;
  1971	
  1972			if ((fgp_flags & FGP_WRITE) && mapping_can_writeback(mapping))
  1973				gfp |= __GFP_WRITE;
  1974			if (fgp_flags & FGP_NOFS)
  1975				gfp &= ~__GFP_FS;
  1976			if (fgp_flags & FGP_NOWAIT) {
  1977				gfp &= ~GFP_KERNEL;
  1978				gfp |= GFP_NOWAIT | __GFP_NOWARN;
  1979			}
  1980			if (WARN_ON_ONCE(!(fgp_flags & (FGP_LOCK | FGP_FOR_MMAP))))
  1981				fgp_flags |= FGP_LOCK;
  1982	
  1983			if (!mapping_large_folio_support(mapping))
  1984				order = 0;
  1985			if (order > MAX_PAGECACHE_ORDER)
  1986				order = MAX_PAGECACHE_ORDER;
  1987			/* If we're not aligned, allocate a smaller folio */
  1988			if (index & ((1UL << order) - 1))
  1989				order = __ffs(index);
  1990	
  1991			do {
  1992				gfp_t alloc_gfp = gfp;
  1993	
  1994				err = -ENOMEM;
  1995				if (order == 1)
  1996					order = 0;
  1997				if (order > 0)
  1998					alloc_gfp |= __GFP_NORETRY | __GFP_NOWARN;
  1999				folio = filemap_alloc_folio(alloc_gfp, order);
  2000				if (!folio)
  2001					continue;
  2002	
  2003				/* Init accessed so avoid atomic mark_page_accessed later */
  2004				if (fgp_flags & FGP_ACCESSED)
  2005					__folio_set_referenced(folio);
  2006	
  2007				err = filemap_add_folio(mapping, folio, index, gfp);
  2008				if (!err)
  2009					break;
  2010				folio_put(folio);
  2011				folio = NULL;
  2012			} while (order-- > 0);
  2013	
  2014			if (err == -EEXIST)
  2015				goto repeat;
  2016			if (err)
  2017				return ERR_PTR(err);
  2018			/*
  2019			 * filemap_add_folio locks the page, and for mmap
  2020			 * we expect an unlocked page.
  2021			 */
  2022			if (folio && (fgp_flags & FGP_FOR_MMAP))
  2023				folio_unlock(folio);
  2024		}
  2025	
  2026		if (!folio)
  2027			return ERR_PTR(-ENOENT);
  2028		return folio;
  2029	}
  2030	EXPORT_SYMBOL(__filemap_get_folio);
  2031	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-07-22 11:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-22 11:43 [android-common:android15-6.6-2025-02 2/2] mm/filemap.c:1933:60: sparse: sparse: incorrect type in argument 3 (different base types) kernel test robot

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.