public inbox for oe-kbuild@lists.linux.dev
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [xiang-erofs:dev-test 2/2] fs/erofs/data.c:45 erofs_bread() warn: passing positive error code '(-4095)-(-1),1-4096' to 'ERR_PTR'
Date: Mon, 30 Mar 2026 17:04:44 +0800	[thread overview]
Message-ID: <202603301620.6HyDa5ME-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: Xiang Gao <xiang@kernel.org>
CC: linux-erofs@lists.ozlabs.org
TO: Gao Xiang <hsiangkao@linux.alibaba.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git dev-test
head:   eabeee4332ac9b5d87ab602f845dbf0e9f854978
commit: eabeee4332ac9b5d87ab602f845dbf0e9f854978 [2/2] erofs: verify metadata accesses for file-backed mounts
:::::: branch date: 6 hours ago
:::::: commit date: 6 hours ago
config: arm-randconfig-r073-20260330 (https://download.01.org/0day-ci/archive/20260330/202603301620.6HyDa5ME-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 10.5.0
smatch: v0.5.0-9004-gb810ac53

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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202603301620.6HyDa5ME-lkp@intel.com/

smatch warnings:
fs/erofs/data.c:45 erofs_bread() warn: passing positive error code '(-4095)-(-1),1-4096' to 'ERR_PTR'

vim +45 fs/erofs/data.c

fdf80a4793021c2 Gao Xiang  2022-01-02  28  
706e50e46af810f Bo Liu     2025-02-17  29  void *erofs_bread(struct erofs_buf *buf, erofs_off_t offset, bool need_kmap)
fdf80a4793021c2 Gao Xiang  2022-01-02  30  {
c36ec00d7f67590 Sheng Yong 2025-05-17  31  	pgoff_t index = (buf->off + offset) >> PAGE_SHIFT;
5d3bb77e5fce1d2 Gao Xiang  2024-07-23  32  	struct folio *folio = NULL;
eabeee4332ac9b5 Gao Xiang  2026-03-30  33  	loff_t fpos;
eabeee4332ac9b5 Gao Xiang  2026-03-30  34  	int err;
eabeee4332ac9b5 Gao Xiang  2026-03-30  35  
eabeee4332ac9b5 Gao Xiang  2026-03-30  36  	/*
eabeee4332ac9b5 Gao Xiang  2026-03-30  37  	 * Metadata access for file-backed mounts reuses page cache of backing
eabeee4332ac9b5 Gao Xiang  2026-03-30  38  	 * fs inodes (only folio data will be needed) to prevent double caching.
eabeee4332ac9b5 Gao Xiang  2026-03-30  39  	 * However, the data access range must be verified here in advance.
eabeee4332ac9b5 Gao Xiang  2026-03-30  40  	 */
eabeee4332ac9b5 Gao Xiang  2026-03-30  41  	if (buf->file) {
eabeee4332ac9b5 Gao Xiang  2026-03-30  42  		fpos = index << PAGE_SHIFT;
eabeee4332ac9b5 Gao Xiang  2026-03-30  43  		err = rw_verify_area(READ, buf->file, &fpos, PAGE_SIZE);
eabeee4332ac9b5 Gao Xiang  2026-03-30  44  		if (err)
eabeee4332ac9b5 Gao Xiang  2026-03-30 @45  			return ERR_PTR(err);
eabeee4332ac9b5 Gao Xiang  2026-03-30  46  	}
fdf80a4793021c2 Gao Xiang  2022-01-02  47  
5d3bb77e5fce1d2 Gao Xiang  2024-07-23  48  	if (buf->page) {
5d3bb77e5fce1d2 Gao Xiang  2024-07-23  49  		folio = page_folio(buf->page);
5d3bb77e5fce1d2 Gao Xiang  2024-07-23  50  		if (folio_file_page(folio, index) != buf->page)
5d3bb77e5fce1d2 Gao Xiang  2024-07-23  51  			erofs_unmap_metabuf(buf);
5d3bb77e5fce1d2 Gao Xiang  2024-07-23  52  	}
5d3bb77e5fce1d2 Gao Xiang  2024-07-23  53  	if (!folio || !folio_contains(folio, index)) {
fdf80a4793021c2 Gao Xiang  2022-01-02  54  		erofs_put_metabuf(buf);
3a23787ca875692 Gao Xiang  2024-11-15  55  		folio = read_mapping_folio(buf->mapping, index, buf->file);
5375e7c8b0fef11 Jeffle Xu  2022-04-25  56  		if (IS_ERR(folio))
5375e7c8b0fef11 Jeffle Xu  2022-04-25  57  			return folio;
fdf80a4793021c2 Gao Xiang  2022-01-02  58  	}
5d3bb77e5fce1d2 Gao Xiang  2024-07-23  59  	buf->page = folio_file_page(folio, index);
706e50e46af810f Bo Liu     2025-02-17  60  	if (!need_kmap)
fdf80a4793021c2 Gao Xiang  2022-01-02  61  		return NULL;
706e50e46af810f Bo Liu     2025-02-17  62  	if (!buf->base)
706e50e46af810f Bo Liu     2025-02-17  63  		buf->base = kmap_local_page(buf->page);
fdf80a4793021c2 Gao Xiang  2022-01-02  64  	return buf->base + (offset & ~PAGE_MASK);
fdf80a4793021c2 Gao Xiang  2022-01-02  65  }
fdf80a4793021c2 Gao Xiang  2022-01-02  66  

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

                 reply	other threads:[~2026-03-30  9:08 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=202603301620.6HyDa5ME-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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