CEPH filesystem development
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Jeff Layton <jlayton@kernel.org>
Cc: kbuild-all@lists.01.org, ceph-devel@vger.kernel.org
Subject: [ceph-client:wip-netfs-lib 5/7] fs/ceph/addr.c:257 ceph_netfs_issue_op() warn: unsigned 'len' is never less than zero.
Date: Tue, 26 Jan 2021 07:50:07 +0800	[thread overview]
Message-ID: <202101260700.DHHXV8N6-lkp@intel.com> (raw)

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

tree:   https://github.com/ceph/ceph-client.git wip-netfs-lib
head:   a72056dc6ccfb6c11070373aaa72e4e3b09decc5
commit: 15f4b2f986a135d8038928d3a2ca63d112987843 [5/7] ceph: convert readpage to fscache read helper
config: x86_64-randconfig-m001-20210125 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-20) 9.3.0

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

New smatch warnings:
fs/ceph/addr.c:257 ceph_netfs_issue_op() warn: unsigned 'len' is never less than zero.

Old smatch warnings:
fs/ceph/addr.c:501 start_read() warn: should 'nr_pages << 12' be a 64 bit type?
fs/ceph/addr.c:536 start_read() warn: should 'nr_pages << 12' be a 64 bit type?
fs/ceph/addr.c:2140 __ceph_pool_perm_get() error: we previously assumed 'pool_ns' could be null (see line 2129)
include/linux/ceph/string_table.h:46 ceph_compare_string() error: we previously assumed 'cs' could be null (see line 41)

vim +/len +257 fs/ceph/addr.c

   230	
   231	static void ceph_netfs_issue_op(struct netfs_read_subrequest *subreq)
   232	{
   233		struct netfs_read_request *rreq = subreq->rreq;
   234		struct inode *inode = rreq->mapping->host;
   235		struct ceph_inode_info *ci = ceph_inode(inode);
   236		struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
   237		struct ceph_osd_request *req = NULL;
   238		struct ceph_vino vino = ceph_vino(inode);
   239		struct iov_iter iter;
   240		struct page **pages;
   241		size_t page_off;
   242		int err = 0;
   243		u64 len = subreq->len;
   244	
   245		req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout, vino, subreq->start, &len,
   246				0, 1, CEPH_OSD_OP_READ,
   247				CEPH_OSD_FLAG_READ | fsc->client->osdc.client->options->read_from_replica,
   248				NULL, ci->i_truncate_seq, ci->i_truncate_size, false);
   249		if (IS_ERR(req)) {
   250			err = PTR_ERR(req);
   251			goto out;
   252		}
   253	
   254		dout("%s: pos=%llu orig_len=%zu len=%llu\n", __func__, subreq->start, subreq->len, len);
   255		iov_iter_xarray(&iter, READ, &rreq->mapping->i_pages, subreq->start, len);
   256		len = iov_iter_get_pages_alloc(&iter, &pages, len, &page_off);
 > 257		if (len < 0) {
   258			err = len;
   259			dout("%s: iov_ter_get_pages_alloc returned %d\n", __func__, err);
   260			goto out;
   261		}
   262	
   263		/* should always give us a page-aligned read */
   264		WARN_ON_ONCE(page_off);
   265	
   266		osd_req_op_extent_osd_data_pages(req, 0, pages, len, 0, false, false);
   267		req->r_callback = finish_netfs_read;
   268		req->r_priv = subreq;
   269		req->r_inode = inode;
   270		ihold(inode);
   271	
   272		err = ceph_osdc_start_request(req->r_osdc, req, false);
   273		if (err)
   274			iput(inode);
   275	out:
   276		if (req)
   277			ceph_osdc_put_request(req);
   278		if (err)
   279			netfs_subreq_terminated(subreq, err);
   280		dout("%s: result %d\n", __func__, err);
   281	}
   282	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 41524 bytes --]

                 reply	other threads:[~2021-01-25 23:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202101260700.DHHXV8N6-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=jlayton@kernel.org \
    --cc=kbuild-all@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox