All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [RFC][PATCH] iov_iter: Add extraction functions
Date: Sun, 11 Sep 2022 16:49:11 +0800	[thread overview]
Message-ID: <202209111623.oK8xGunY-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 4875 bytes --]

BCC: lkp(a)intel.com
CC: kbuild-all(a)lists.01.org
In-Reply-To: <3750754.1662765490@warthog.procyon.org.uk>
References: <3750754.1662765490@warthog.procyon.org.uk>
TO: David Howells <dhowells@redhat.com>

Hi David,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on linus/master]
[also build test WARNING on v6.0-rc4 next-20220909]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/David-Howells/iov_iter-Add-extraction-functions/20220910-072102
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ce888220d5c7a805e0e155302a318d5d23e62950
:::::: branch date: 33 hours ago
:::::: commit date: 33 hours ago
config: x86_64-randconfig-m001 (https://download.01.org/0day-ci/archive/20220911/202209111623.oK8xGunY-lkp(a)intel.com/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
lib/iov_iter_extract.c:360 iov_iter_extract_xarray() error: uninitialized symbol 'ret'.

vim +/ret +360 lib/iov_iter_extract.c

a8df8a89788037 David Howells 2022-09-10  314  
a8df8a89788037 David Howells 2022-09-10  315  /*
a8df8a89788037 David Howells 2022-09-10  316   * Extract the pages from an XARRAY-class iterator and add them to the
a8df8a89788037 David Howells 2022-09-10  317   * destination buffer.  The pages are not pinned.
a8df8a89788037 David Howells 2022-09-10  318   */
a8df8a89788037 David Howells 2022-09-10  319  static ssize_t iov_iter_extract_xarray(struct iov_iter *iter,
a8df8a89788037 David Howells 2022-09-10  320  				       void *array, unsigned int array_max,
a8df8a89788037 David Howells 2022-09-10  321  				       ssize_t maxsize,
a8df8a89788037 David Howells 2022-09-10  322  				       enum iter_extract_dest dest)
a8df8a89788037 David Howells 2022-09-10  323  {
a8df8a89788037 David Howells 2022-09-10  324  	struct xarray *xa = iter->xarray;
a8df8a89788037 David Howells 2022-09-10  325  	struct folio *folio;
a8df8a89788037 David Howells 2022-09-10  326  	unsigned int ix;
a8df8a89788037 David Howells 2022-09-10  327  	loff_t start = iter->xarray_start + iter->iov_offset;
a8df8a89788037 David Howells 2022-09-10  328  	pgoff_t index = start / PAGE_SIZE;
a8df8a89788037 David Howells 2022-09-10  329  	ssize_t ret;
a8df8a89788037 David Howells 2022-09-10  330  	size_t offset, len;
a8df8a89788037 David Howells 2022-09-10  331  	XA_STATE(xas, xa, index);
a8df8a89788037 David Howells 2022-09-10  332  
a8df8a89788037 David Howells 2022-09-10  333  	rcu_read_lock();
a8df8a89788037 David Howells 2022-09-10  334  	xas_for_each(&xas, folio, ULONG_MAX) {
a8df8a89788037 David Howells 2022-09-10  335  		if (xas_retry(&xas, folio))
a8df8a89788037 David Howells 2022-09-10  336  			continue;
a8df8a89788037 David Howells 2022-09-10  337  		if (WARN_ON(xa_is_value(folio)))
a8df8a89788037 David Howells 2022-09-10  338  			break;
a8df8a89788037 David Howells 2022-09-10  339  		if (WARN_ON(folio_test_hugetlb(folio)))
a8df8a89788037 David Howells 2022-09-10  340  			break;
a8df8a89788037 David Howells 2022-09-10  341  
a8df8a89788037 David Howells 2022-09-10  342  		offset = offset_in_folio(folio, start);
a8df8a89788037 David Howells 2022-09-10  343  		len = min_t(size_t, maxsize, folio_size(folio) - offset);
a8df8a89788037 David Howells 2022-09-10  344  
a8df8a89788037 David Howells 2022-09-10  345  		ix = extract_contig_pages(array, folio_page(folio, 0),
a8df8a89788037 David Howells 2022-09-10  346  					  offset, len, dest);
a8df8a89788037 David Howells 2022-09-10  347  		maxsize -= len;
a8df8a89788037 David Howells 2022-09-10  348  		ret += len;
a8df8a89788037 David Howells 2022-09-10  349  		if (ix >= array_max) {
a8df8a89788037 David Howells 2022-09-10  350  			WARN_ON_ONCE(ix > array_max);
a8df8a89788037 David Howells 2022-09-10  351  			break;
a8df8a89788037 David Howells 2022-09-10  352  		}
a8df8a89788037 David Howells 2022-09-10  353  
a8df8a89788037 David Howells 2022-09-10  354  		if (maxsize <= 0)
a8df8a89788037 David Howells 2022-09-10  355  			break;
a8df8a89788037 David Howells 2022-09-10  356  	}
a8df8a89788037 David Howells 2022-09-10  357  
a8df8a89788037 David Howells 2022-09-10  358  	rcu_read_unlock();
a8df8a89788037 David Howells 2022-09-10  359  	terminate_array(array, dest);
a8df8a89788037 David Howells 2022-09-10 @360  	return ret;
a8df8a89788037 David Howells 2022-09-10  361  }
a8df8a89788037 David Howells 2022-09-10  362  

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

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [RFC][PATCH] iov_iter: Add extraction functions
Date: Tue, 13 Sep 2022 12:21:25 +0300	[thread overview]
Message-ID: <202209111623.oK8xGunY-lkp@intel.com> (raw)
In-Reply-To: <3750754.1662765490@warthog.procyon.org.uk>

[-- Attachment #1: Type: text/plain, Size: 4032 bytes --]

Hi David,

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/David-Howells/iov_iter-Add-extraction-functions/20220910-072102
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ce888220d5c7a805e0e155302a318d5d23e62950
config: x86_64-randconfig-m001 (https://download.01.org/0day-ci/archive/20220911/202209111623.oK8xGunY-lkp(a)intel.com/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
lib/iov_iter_extract.c:360 iov_iter_extract_xarray() error: uninitialized symbol 'ret'.

vim +/ret +360 lib/iov_iter_extract.c

a8df8a89788037 David Howells 2022-09-10  319  static ssize_t iov_iter_extract_xarray(struct iov_iter *iter,
a8df8a89788037 David Howells 2022-09-10  320  				       void *array, unsigned int array_max,
a8df8a89788037 David Howells 2022-09-10  321  				       ssize_t maxsize,
a8df8a89788037 David Howells 2022-09-10  322  				       enum iter_extract_dest dest)
a8df8a89788037 David Howells 2022-09-10  323  {
a8df8a89788037 David Howells 2022-09-10  324  	struct xarray *xa = iter->xarray;
a8df8a89788037 David Howells 2022-09-10  325  	struct folio *folio;
a8df8a89788037 David Howells 2022-09-10  326  	unsigned int ix;
a8df8a89788037 David Howells 2022-09-10  327  	loff_t start = iter->xarray_start + iter->iov_offset;
a8df8a89788037 David Howells 2022-09-10  328  	pgoff_t index = start / PAGE_SIZE;
a8df8a89788037 David Howells 2022-09-10  329  	ssize_t ret;
a8df8a89788037 David Howells 2022-09-10  330  	size_t offset, len;
a8df8a89788037 David Howells 2022-09-10  331  	XA_STATE(xas, xa, index);
a8df8a89788037 David Howells 2022-09-10  332  
a8df8a89788037 David Howells 2022-09-10  333  	rcu_read_lock();
a8df8a89788037 David Howells 2022-09-10  334  	xas_for_each(&xas, folio, ULONG_MAX) {
a8df8a89788037 David Howells 2022-09-10  335  		if (xas_retry(&xas, folio))
a8df8a89788037 David Howells 2022-09-10  336  			continue;
a8df8a89788037 David Howells 2022-09-10  337  		if (WARN_ON(xa_is_value(folio)))
a8df8a89788037 David Howells 2022-09-10  338  			break;
a8df8a89788037 David Howells 2022-09-10  339  		if (WARN_ON(folio_test_hugetlb(folio)))
a8df8a89788037 David Howells 2022-09-10  340  			break;

Can we hit these breaks on the first iteration through the loop?  Or
hit continue every time, I guess...

a8df8a89788037 David Howells 2022-09-10  341  
a8df8a89788037 David Howells 2022-09-10  342  		offset = offset_in_folio(folio, start);
a8df8a89788037 David Howells 2022-09-10  343  		len = min_t(size_t, maxsize, folio_size(folio) - offset);
a8df8a89788037 David Howells 2022-09-10  344  
a8df8a89788037 David Howells 2022-09-10  345  		ix = extract_contig_pages(array, folio_page(folio, 0),
a8df8a89788037 David Howells 2022-09-10  346  					  offset, len, dest);
a8df8a89788037 David Howells 2022-09-10  347  		maxsize -= len;
a8df8a89788037 David Howells 2022-09-10  348  		ret += len;

ret is never initialized.

a8df8a89788037 David Howells 2022-09-10  349  		if (ix >= array_max) {
a8df8a89788037 David Howells 2022-09-10  350  			WARN_ON_ONCE(ix > array_max);
a8df8a89788037 David Howells 2022-09-10  351  			break;
a8df8a89788037 David Howells 2022-09-10  352  		}
a8df8a89788037 David Howells 2022-09-10  353  
a8df8a89788037 David Howells 2022-09-10  354  		if (maxsize <= 0)
a8df8a89788037 David Howells 2022-09-10  355  			break;
a8df8a89788037 David Howells 2022-09-10  356  	}
a8df8a89788037 David Howells 2022-09-10  357  
a8df8a89788037 David Howells 2022-09-10  358  	rcu_read_unlock();
a8df8a89788037 David Howells 2022-09-10  359  	terminate_array(array, dest);
a8df8a89788037 David Howells 2022-09-10 @360  	return ret;
a8df8a89788037 David Howells 2022-09-10  361  }

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

             reply	other threads:[~2022-09-11  8:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-11  8:49 kernel test robot [this message]
2022-09-13  9:21 ` [RFC][PATCH] iov_iter: Add extraction functions Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2022-09-12 14:57 kernel test robot
2022-09-12  0:44 kernel test robot
2022-09-09 23:18 David Howells
2022-09-10 12:16 ` kernel test robot
2022-09-24  2:22 ` Al Viro
2022-10-14 12:22   ` David Howells
2022-10-18 14:29   ` David Howells
2022-10-18 14:48     ` Christoph Hellwig

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=202209111623.oK8xGunY-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /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.