lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202209031437.da4oMdee-lkp@intel.com>
Date:   Sat, 3 Sep 2022 14:28:53 +0800
From:   kernel test robot <lkp@...el.com>
To:     "Matthew Wilcox (Oracle)" <willy@...radead.org>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        Ammar Faizi <ammarfaizi2@...weeb.org>,
        GNU/Weeb Mailing List <gwml@...r.gnuweeb.org>,
        linux-kernel@...r.kernel.org,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux Memory Management List <linux-mm@...ck.org>
Subject: [ammarfaizi2-block:akpm/mm/mm-unstable 402/439] mm/shmem.c:1738:10:
 error: implicit declaration of function 'swap_cache_get_folio' is invalid in
 C99

tree:   https://github.com/ammarfaizi2/linux-block akpm/mm/mm-unstable
head:   1e6b789996e7b8b0d382a144a6dccde7b824b510
commit: 91a46452f641672b82f8a01c9f114f85cdfe0d76 [402/439] shmem: eliminate struct page from shmem_swapin_folio()
config: x86_64-randconfig-a012 (https://download.01.org/0day-ci/archive/20220903/202209031437.da4oMdee-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/ammarfaizi2/linux-block/commit/91a46452f641672b82f8a01c9f114f85cdfe0d76
        git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
        git fetch --no-tags ammarfaizi2-block akpm/mm/mm-unstable
        git checkout 91a46452f641672b82f8a01c9f114f85cdfe0d76
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>

All error/warnings (new ones prefixed by >>):

>> mm/shmem.c:1738:10: error: implicit declaration of function 'swap_cache_get_folio' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
           folio = swap_cache_get_folio(swap, NULL, 0);
                   ^
>> mm/shmem.c:1738:8: warning: incompatible integer to pointer conversion assigning to 'struct folio *' from 'int' [-Wint-conversion]
           folio = swap_cache_get_folio(swap, NULL, 0);
                 ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning and 1 error generated.


vim +/swap_cache_get_folio +1738 mm/shmem.c

  1711	
  1712	/*
  1713	 * Swap in the folio pointed to by *foliop.
  1714	 * Caller has to make sure that *foliop contains a valid swapped folio.
  1715	 * Returns 0 and the folio in foliop if success. On failure, returns the
  1716	 * error code and NULL in *foliop.
  1717	 */
  1718	static int shmem_swapin_folio(struct inode *inode, pgoff_t index,
  1719				     struct folio **foliop, enum sgp_type sgp,
  1720				     gfp_t gfp, struct vm_area_struct *vma,
  1721				     vm_fault_t *fault_type)
  1722	{
  1723		struct address_space *mapping = inode->i_mapping;
  1724		struct shmem_inode_info *info = SHMEM_I(inode);
  1725		struct mm_struct *charge_mm = vma ? vma->vm_mm : NULL;
  1726		struct folio *folio = NULL;
  1727		swp_entry_t swap;
  1728		int error;
  1729	
  1730		VM_BUG_ON(!*foliop || !xa_is_value(*foliop));
  1731		swap = radix_to_swp_entry(*foliop);
  1732		*foliop = NULL;
  1733	
  1734		if (is_swapin_error_entry(swap))
  1735			return -EIO;
  1736	
  1737		/* Look it up and read it in.. */
> 1738		folio = swap_cache_get_folio(swap, NULL, 0);
  1739		if (!folio) {
  1740			/* Or update major stats only when swapin succeeds?? */
  1741			if (fault_type) {
  1742				*fault_type |= VM_FAULT_MAJOR;
  1743				count_vm_event(PGMAJFAULT);
  1744				count_memcg_event_mm(charge_mm, PGMAJFAULT);
  1745			}
  1746			/* Here we actually start the io */
  1747			folio = shmem_swapin(swap, gfp, info, index);
  1748			if (!folio) {
  1749				error = -ENOMEM;
  1750				goto failed;
  1751			}
  1752		}
  1753	
  1754		/* We have to do this with folio locked to prevent races */
  1755		folio_lock(folio);
  1756		if (!folio_test_swapcache(folio) ||
  1757		    folio_swap_entry(folio).val != swap.val ||
  1758		    !shmem_confirm_swap(mapping, index, swap)) {
  1759			error = -EEXIST;
  1760			goto unlock;
  1761		}
  1762		if (!folio_test_uptodate(folio)) {
  1763			error = -EIO;
  1764			goto failed;
  1765		}
  1766		folio_wait_writeback(folio);
  1767	
  1768		/*
  1769		 * Some architectures may have to restore extra metadata to the
  1770		 * folio after reading from swap.
  1771		 */
  1772		arch_swap_restore(swap, folio);
  1773	
  1774		if (shmem_should_replace_folio(folio, gfp)) {
  1775			error = shmem_replace_folio(&folio, gfp, info, index);
  1776			if (error)
  1777				goto failed;
  1778		}
  1779	
  1780		error = shmem_add_to_page_cache(folio, mapping, index,
  1781						swp_to_radix_entry(swap), gfp,
  1782						charge_mm);
  1783		if (error)
  1784			goto failed;
  1785	
  1786		spin_lock_irq(&info->lock);
  1787		info->swapped--;
  1788		shmem_recalc_inode(inode);
  1789		spin_unlock_irq(&info->lock);
  1790	
  1791		if (sgp == SGP_WRITE)
  1792			folio_mark_accessed(folio);
  1793	
  1794		delete_from_swap_cache(folio);
  1795		folio_mark_dirty(folio);
  1796		swap_free(swap);
  1797	
  1798		*foliop = folio;
  1799		return 0;
  1800	failed:
  1801		if (!shmem_confirm_swap(mapping, index, swap))
  1802			error = -EEXIST;
  1803		if (error == -EIO)
  1804			shmem_set_folio_swapin_error(inode, index, folio, swap);
  1805	unlock:
  1806		if (folio) {
  1807			folio_unlock(folio);
  1808			folio_put(folio);
  1809		}
  1810	
  1811		return error;
  1812	}
  1813	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ