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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202103280658.kByZmw5Q-lkp@intel.com>
Date:   Sun, 28 Mar 2021 06:16:15 +0800
From:   kernel test robot <lkp@...el.com>
To:     Christophe Leroy <christophe.leroy@...roup.eu>
Cc:     kbuild-all@...ts.01.org, clang-built-linux@...glegroups.com,
        linux-kernel@...r.kernel.org, Michael Ellerman <mpe@...erman.id.au>
Subject: fs/ntfs/aops.c:378:12: warning: stack frame size of 2288 bytes in
 function 'ntfs_readpage'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   0f4498cef9f5cd18d7c6639a2a902ec1edc5be4e
commit: 4eeef098b43242ed145c83fba9989d586d707589 powerpc/44x: Remove STDBINUTILS kconfig option
date:   8 weeks ago
config: powerpc64-randconfig-r036-20210328 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project d50fe9f0d6b9ee61df8830a67ea0a33c27a637e7)
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
        # install powerpc64 cross compiling tool for clang build
        # apt-get install binutils-powerpc64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4eeef098b43242ed145c83fba9989d586d707589
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 4eeef098b43242ed145c83fba9989d586d707589
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64 

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

All warnings (new ones prefixed by >>):

>> fs/ntfs/aops.c:378:12: warning: stack frame size of 2288 bytes in function 'ntfs_readpage' [-Wframe-larger-than=]
   static int ntfs_readpage(struct file *file, struct page *page)
              ^
   1 warning generated.
--
>> net/bluetooth/hci_core.c:2108:26: warning: result of comparison of constant 65536 with expression of type '__u16' (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare]
           if (!dev_num || dev_num > (PAGE_SIZE * 2) / sizeof(*dr))
           ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ~~~~~~~~~~~~~~~~~^~~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
>> net/bluetooth/hci_core.c:2108:26: warning: result of comparison of constant 65536 with expression of type '__u16' (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare]
           if (!dev_num || dev_num > (PAGE_SIZE * 2) / sizeof(*dr))
           ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> net/bluetooth/hci_core.c:2108:26: warning: result of comparison of constant 65536 with expression of type '__u16' (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare]
           if (!dev_num || dev_num > (PAGE_SIZE * 2) / sizeof(*dr))
           ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:61: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                               ^~~~
   3 warnings generated.


vim +/ntfs_readpage +378 fs/ntfs/aops.c

^1da177e4c3f41 Linus Torvalds     2005-04-16  359  
^1da177e4c3f41 Linus Torvalds     2005-04-16  360  /**
^1da177e4c3f41 Linus Torvalds     2005-04-16  361   * ntfs_readpage - fill a @page of a @file with data from the device
^1da177e4c3f41 Linus Torvalds     2005-04-16  362   * @file:	open file to which the page @page belongs or NULL
^1da177e4c3f41 Linus Torvalds     2005-04-16  363   * @page:	page cache page to fill with data
^1da177e4c3f41 Linus Torvalds     2005-04-16  364   *
^1da177e4c3f41 Linus Torvalds     2005-04-16  365   * For non-resident attributes, ntfs_readpage() fills the @page of the open
^1da177e4c3f41 Linus Torvalds     2005-04-16  366   * file @file by calling the ntfs version of the generic block_read_full_page()
^1da177e4c3f41 Linus Torvalds     2005-04-16  367   * function, ntfs_read_block(), which in turn creates and reads in the buffers
^1da177e4c3f41 Linus Torvalds     2005-04-16  368   * associated with the page asynchronously.
^1da177e4c3f41 Linus Torvalds     2005-04-16  369   *
^1da177e4c3f41 Linus Torvalds     2005-04-16  370   * For resident attributes, OTOH, ntfs_readpage() fills @page by copying the
^1da177e4c3f41 Linus Torvalds     2005-04-16  371   * data from the mft record (which at this stage is most likely in memory) and
^1da177e4c3f41 Linus Torvalds     2005-04-16  372   * fills the remainder with zeroes. Thus, in this case, I/O is synchronous, as
^1da177e4c3f41 Linus Torvalds     2005-04-16  373   * even if the mft record is not cached at this point in time, we need to wait
^1da177e4c3f41 Linus Torvalds     2005-04-16  374   * for it to be read in before we can do the copy.
^1da177e4c3f41 Linus Torvalds     2005-04-16  375   *
^1da177e4c3f41 Linus Torvalds     2005-04-16  376   * Return 0 on success and -errno on error.
^1da177e4c3f41 Linus Torvalds     2005-04-16  377   */
^1da177e4c3f41 Linus Torvalds     2005-04-16 @378  static int ntfs_readpage(struct file *file, struct page *page)
^1da177e4c3f41 Linus Torvalds     2005-04-16  379  {
f6098cf449b81c Anton Altaparmakov 2005-09-19  380  	loff_t i_size;
f6098cf449b81c Anton Altaparmakov 2005-09-19  381  	struct inode *vi;
^1da177e4c3f41 Linus Torvalds     2005-04-16  382  	ntfs_inode *ni, *base_ni;
bfab36e81611e6 Anton Altaparmakov 2007-10-12  383  	u8 *addr;
^1da177e4c3f41 Linus Torvalds     2005-04-16  384  	ntfs_attr_search_ctx *ctx;
^1da177e4c3f41 Linus Torvalds     2005-04-16  385  	MFT_RECORD *mrec;
b6ad6c52fe36ab Anton Altaparmakov 2005-02-15  386  	unsigned long flags;
^1da177e4c3f41 Linus Torvalds     2005-04-16  387  	u32 attr_len;
^1da177e4c3f41 Linus Torvalds     2005-04-16  388  	int err = 0;
^1da177e4c3f41 Linus Torvalds     2005-04-16  389  
905685f68fc728 Anton Altaparmakov 2005-03-10  390  retry_readpage:
^1da177e4c3f41 Linus Torvalds     2005-04-16  391  	BUG_ON(!PageLocked(page));
ebab89909e0dc7 Anton Altaparmakov 2007-11-03  392  	vi = page->mapping->host;
ebab89909e0dc7 Anton Altaparmakov 2007-11-03  393  	i_size = i_size_read(vi);
ebab89909e0dc7 Anton Altaparmakov 2007-11-03  394  	/* Is the page fully outside i_size? (truncate in progress) */
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  395  	if (unlikely(page->index >= (i_size + PAGE_SIZE - 1) >>
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  396  			PAGE_SHIFT)) {
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  397  		zero_user(page, 0, PAGE_SIZE);
ebab89909e0dc7 Anton Altaparmakov 2007-11-03  398  		ntfs_debug("Read outside i_size - truncated?");
ebab89909e0dc7 Anton Altaparmakov 2007-11-03  399  		goto done;
ebab89909e0dc7 Anton Altaparmakov 2007-11-03  400  	}
^1da177e4c3f41 Linus Torvalds     2005-04-16  401  	/*
^1da177e4c3f41 Linus Torvalds     2005-04-16  402  	 * This can potentially happen because we clear PageUptodate() during
^1da177e4c3f41 Linus Torvalds     2005-04-16  403  	 * ntfs_writepage() of MstProtected() attributes.
^1da177e4c3f41 Linus Torvalds     2005-04-16  404  	 */
^1da177e4c3f41 Linus Torvalds     2005-04-16  405  	if (PageUptodate(page)) {
^1da177e4c3f41 Linus Torvalds     2005-04-16  406  		unlock_page(page);
^1da177e4c3f41 Linus Torvalds     2005-04-16  407  		return 0;
^1da177e4c3f41 Linus Torvalds     2005-04-16  408  	}
f6098cf449b81c Anton Altaparmakov 2005-09-19  409  	ni = NTFS_I(vi);
^1da177e4c3f41 Linus Torvalds     2005-04-16  410  	/*
311120eca00130 Anton Altaparmakov 2005-09-08  411  	 * Only $DATA attributes can be encrypted and only unnamed $DATA
311120eca00130 Anton Altaparmakov 2005-09-08  412  	 * attributes can be compressed.  Index root can have the flags set but
311120eca00130 Anton Altaparmakov 2005-09-08  413  	 * this means to create compressed/encrypted files, not that the
4e64c88693fde1 Anton Altaparmakov 2005-09-19  414  	 * attribute is compressed/encrypted.  Note we need to check for
4e64c88693fde1 Anton Altaparmakov 2005-09-19  415  	 * AT_INDEX_ALLOCATION since this is the type of both directory and
4e64c88693fde1 Anton Altaparmakov 2005-09-19  416  	 * index inodes.
^1da177e4c3f41 Linus Torvalds     2005-04-16  417  	 */
4e64c88693fde1 Anton Altaparmakov 2005-09-19  418  	if (ni->type != AT_INDEX_ALLOCATION) {
311120eca00130 Anton Altaparmakov 2005-09-08  419  		/* If attribute is encrypted, deny access, just like NT4. */
^1da177e4c3f41 Linus Torvalds     2005-04-16  420  		if (NInoEncrypted(ni)) {
311120eca00130 Anton Altaparmakov 2005-09-08  421  			BUG_ON(ni->type != AT_DATA);
^1da177e4c3f41 Linus Torvalds     2005-04-16  422  			err = -EACCES;
^1da177e4c3f41 Linus Torvalds     2005-04-16  423  			goto err_out;
^1da177e4c3f41 Linus Torvalds     2005-04-16  424  		}
^1da177e4c3f41 Linus Torvalds     2005-04-16  425  		/* Compressed data streams are handled in compress.c. */
311120eca00130 Anton Altaparmakov 2005-09-08  426  		if (NInoNonResident(ni) && NInoCompressed(ni)) {
311120eca00130 Anton Altaparmakov 2005-09-08  427  			BUG_ON(ni->type != AT_DATA);
311120eca00130 Anton Altaparmakov 2005-09-08  428  			BUG_ON(ni->name_len);
^1da177e4c3f41 Linus Torvalds     2005-04-16  429  			return ntfs_read_compressed_block(page);
^1da177e4c3f41 Linus Torvalds     2005-04-16  430  		}
311120eca00130 Anton Altaparmakov 2005-09-08  431  	}
311120eca00130 Anton Altaparmakov 2005-09-08  432  	/* NInoNonResident() == NInoIndexAllocPresent() */
311120eca00130 Anton Altaparmakov 2005-09-08  433  	if (NInoNonResident(ni)) {
311120eca00130 Anton Altaparmakov 2005-09-08  434  		/* Normal, non-resident data stream. */
^1da177e4c3f41 Linus Torvalds     2005-04-16  435  		return ntfs_read_block(page);
^1da177e4c3f41 Linus Torvalds     2005-04-16  436  	}
^1da177e4c3f41 Linus Torvalds     2005-04-16  437  	/*
^1da177e4c3f41 Linus Torvalds     2005-04-16  438  	 * Attribute is resident, implying it is not compressed or encrypted.
^1da177e4c3f41 Linus Torvalds     2005-04-16  439  	 * This also means the attribute is smaller than an mft record and
^1da177e4c3f41 Linus Torvalds     2005-04-16  440  	 * hence smaller than a page, so can simply zero out any pages with
311120eca00130 Anton Altaparmakov 2005-09-08  441  	 * index above 0.  Note the attribute can actually be marked compressed
311120eca00130 Anton Altaparmakov 2005-09-08  442  	 * but if it is resident the actual data is not compressed so we are
311120eca00130 Anton Altaparmakov 2005-09-08  443  	 * ok to ignore the compressed flag here.
^1da177e4c3f41 Linus Torvalds     2005-04-16  444  	 */
b6ad6c52fe36ab Anton Altaparmakov 2005-02-15  445  	if (unlikely(page->index > 0)) {
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  446  		zero_user(page, 0, PAGE_SIZE);
^1da177e4c3f41 Linus Torvalds     2005-04-16  447  		goto done;
^1da177e4c3f41 Linus Torvalds     2005-04-16  448  	}
^1da177e4c3f41 Linus Torvalds     2005-04-16  449  	if (!NInoAttr(ni))
^1da177e4c3f41 Linus Torvalds     2005-04-16  450  		base_ni = ni;
^1da177e4c3f41 Linus Torvalds     2005-04-16  451  	else
^1da177e4c3f41 Linus Torvalds     2005-04-16  452  		base_ni = ni->ext.base_ntfs_ino;
^1da177e4c3f41 Linus Torvalds     2005-04-16  453  	/* Map, pin, and lock the mft record. */
^1da177e4c3f41 Linus Torvalds     2005-04-16  454  	mrec = map_mft_record(base_ni);
^1da177e4c3f41 Linus Torvalds     2005-04-16  455  	if (IS_ERR(mrec)) {
^1da177e4c3f41 Linus Torvalds     2005-04-16  456  		err = PTR_ERR(mrec);
^1da177e4c3f41 Linus Torvalds     2005-04-16  457  		goto err_out;
^1da177e4c3f41 Linus Torvalds     2005-04-16  458  	}
905685f68fc728 Anton Altaparmakov 2005-03-10  459  	/*
905685f68fc728 Anton Altaparmakov 2005-03-10  460  	 * If a parallel write made the attribute non-resident, drop the mft
905685f68fc728 Anton Altaparmakov 2005-03-10  461  	 * record and retry the readpage.
905685f68fc728 Anton Altaparmakov 2005-03-10  462  	 */
905685f68fc728 Anton Altaparmakov 2005-03-10  463  	if (unlikely(NInoNonResident(ni))) {
905685f68fc728 Anton Altaparmakov 2005-03-10  464  		unmap_mft_record(base_ni);
905685f68fc728 Anton Altaparmakov 2005-03-10  465  		goto retry_readpage;
905685f68fc728 Anton Altaparmakov 2005-03-10  466  	}
^1da177e4c3f41 Linus Torvalds     2005-04-16  467  	ctx = ntfs_attr_get_search_ctx(base_ni, mrec);
^1da177e4c3f41 Linus Torvalds     2005-04-16  468  	if (unlikely(!ctx)) {
^1da177e4c3f41 Linus Torvalds     2005-04-16  469  		err = -ENOMEM;
^1da177e4c3f41 Linus Torvalds     2005-04-16  470  		goto unm_err_out;
^1da177e4c3f41 Linus Torvalds     2005-04-16  471  	}
^1da177e4c3f41 Linus Torvalds     2005-04-16  472  	err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len,
^1da177e4c3f41 Linus Torvalds     2005-04-16  473  			CASE_SENSITIVE, 0, NULL, 0, ctx);
^1da177e4c3f41 Linus Torvalds     2005-04-16  474  	if (unlikely(err))
^1da177e4c3f41 Linus Torvalds     2005-04-16  475  		goto put_unm_err_out;
^1da177e4c3f41 Linus Torvalds     2005-04-16  476  	attr_len = le32_to_cpu(ctx->attr->data.resident.value_length);
b6ad6c52fe36ab Anton Altaparmakov 2005-02-15  477  	read_lock_irqsave(&ni->size_lock, flags);
b6ad6c52fe36ab Anton Altaparmakov 2005-02-15  478  	if (unlikely(attr_len > ni->initialized_size))
b6ad6c52fe36ab Anton Altaparmakov 2005-02-15  479  		attr_len = ni->initialized_size;
f6098cf449b81c Anton Altaparmakov 2005-09-19  480  	i_size = i_size_read(vi);
b6ad6c52fe36ab Anton Altaparmakov 2005-02-15  481  	read_unlock_irqrestore(&ni->size_lock, flags);
f6098cf449b81c Anton Altaparmakov 2005-09-19  482  	if (unlikely(attr_len > i_size)) {
f6098cf449b81c Anton Altaparmakov 2005-09-19  483  		/* Race with shrinking truncate. */
f6098cf449b81c Anton Altaparmakov 2005-09-19  484  		attr_len = i_size;
f6098cf449b81c Anton Altaparmakov 2005-09-19  485  	}
a3ac1414eb6011 Cong Wang          2011-11-25  486  	addr = kmap_atomic(page);
^1da177e4c3f41 Linus Torvalds     2005-04-16  487  	/* Copy the data to the page. */
bfab36e81611e6 Anton Altaparmakov 2007-10-12  488  	memcpy(addr, (u8*)ctx->attr +
^1da177e4c3f41 Linus Torvalds     2005-04-16  489  			le16_to_cpu(ctx->attr->data.resident.value_offset),
^1da177e4c3f41 Linus Torvalds     2005-04-16  490  			attr_len);
^1da177e4c3f41 Linus Torvalds     2005-04-16  491  	/* Zero the remainder of the page. */
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  492  	memset(addr + attr_len, 0, PAGE_SIZE - attr_len);
^1da177e4c3f41 Linus Torvalds     2005-04-16  493  	flush_dcache_page(page);
a3ac1414eb6011 Cong Wang          2011-11-25  494  	kunmap_atomic(addr);
^1da177e4c3f41 Linus Torvalds     2005-04-16  495  put_unm_err_out:
^1da177e4c3f41 Linus Torvalds     2005-04-16  496  	ntfs_attr_put_search_ctx(ctx);
^1da177e4c3f41 Linus Torvalds     2005-04-16  497  unm_err_out:
^1da177e4c3f41 Linus Torvalds     2005-04-16  498  	unmap_mft_record(base_ni);
^1da177e4c3f41 Linus Torvalds     2005-04-16  499  done:
^1da177e4c3f41 Linus Torvalds     2005-04-16  500  	SetPageUptodate(page);
^1da177e4c3f41 Linus Torvalds     2005-04-16  501  err_out:
^1da177e4c3f41 Linus Torvalds     2005-04-16  502  	unlock_page(page);
^1da177e4c3f41 Linus Torvalds     2005-04-16  503  	return err;
^1da177e4c3f41 Linus Torvalds     2005-04-16  504  }
^1da177e4c3f41 Linus Torvalds     2005-04-16  505  

:::::: The code at line 378 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@...970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@...970.osdl.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (34194 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ