mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Gao Xiang <hsiangkao@linux.alibaba.com>
Cc: kbuild-all@lists.01.org, Xiang Gao <xiang@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: [xiang-linux:erofs/chunk 8/8] fs/erofs/data.c:136:25: sparse: sparse: cast to restricted __le32
Date: Mon, 16 Aug 2021 09:36:24 +0800	[thread overview]
Message-ID: <202108160922.E6giy4cO-lkp@intel.com> (raw)

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/xiang/linux.git erofs/chunk
head:   a915f0e209270389efab942fcd446e31a98c4062
commit: a915f0e209270389efab942fcd446e31a98c4062 [8/8] erofs: support reading chunk-based files
config: x86_64-randconfig-s021-20210816 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-348-gf0e6938b-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/xiang/linux.git/commit/?id=a915f0e209270389efab942fcd446e31a98c4062
        git remote add xiang-linux https://git.kernel.org/pub/scm/linux/kernel/git/xiang/linux.git
        git fetch --no-tags xiang-linux erofs/chunk
        git checkout a915f0e209270389efab942fcd446e31a98c4062
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash fs/erofs/

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


sparse warnings: (new ones prefixed by >>)
>> fs/erofs/data.c:136:25: sparse: sparse: cast to restricted __le32
>> fs/erofs/data.c:136:25: sparse: sparse: cast from restricted __le16

vim +136 fs/erofs/data.c

    80	
    81	static int erofs_map_blocks(struct inode *inode,
    82				    struct erofs_map_blocks *map, int flags)
    83	{
    84		struct super_block *sb = inode->i_sb;
    85		struct erofs_inode *vi = EROFS_I(inode);
    86		struct erofs_inode_chunk_index *idx;
    87		struct page *page;
    88		u64 chunknr;
    89		unsigned int unit;
    90		erofs_off_t pos;
    91		int err;
    92	
    93		if (map->m_la >= inode->i_size) {
    94			map->m_flags = 0;
    95			map->m_plen = 0;
    96			goto out;
    97		}
    98	
    99		if (vi->datalayout != EROFS_INODE_CHUNK_BASED)
   100			return erofs_map_blocks_flatmode(inode, map, flags);
   101	
   102		if (vi->chunkformat & EROFS_CHUNK_FORMAT_INDEXES)
   103			unit = sizeof(*idx);	/* chunk index */
   104		else
   105			unit = 4;		/* chunk index */
   106	
   107		chunknr = map->m_la >> vi->chunkbits;
   108		pos = ALIGN(iloc(EROFS_SB(sb), vi->nid) + vi->inode_isize +
   109			    vi->xattr_isize, unit) + unit * chunknr;
   110	
   111		page = erofs_get_meta_page(inode->i_sb, erofs_blknr(pos));
   112		if (IS_ERR(page))
   113			return PTR_ERR(page);
   114	
   115		err = 0;
   116		map->m_plen = min_t(erofs_off_t, 1 << vi->chunkbits,
   117				    inode->i_size - map->m_la);
   118		if (!(vi->chunkformat & EROFS_CHUNK_FORMAT_INDEXES)) {
   119			__le32 *blkaddr = page_address(page) + erofs_blkoff(pos);
   120	
   121			if (le32_to_cpu(*blkaddr) == EROFS_NULL_ADDR) {
   122				map->m_flags = 0;
   123			} else {
   124				map->m_pa = blknr_to_addr(le32_to_cpu(*blkaddr));
   125				map->m_flags = EROFS_MAP_MAPPED;
   126			}
   127			goto out_unlock;
   128		}
   129		idx = page_address(page) + erofs_blkoff(pos);
   130		switch (le32_to_cpu(idx->blkaddr)) {
   131		case EROFS_NULL_ADDR:
   132			map->m_flags = 0;
   133			break;
   134		default:
   135			if (idx->device_id) {
 > 136				erofs_err(sb, "invalid device %u @ %llu for nid %llu",
   137					  le32_to_cpu(idx->device_id),
   138					  chunknr, vi->nid);
   139				err = -EINVAL;
   140				goto out;
   141			}
   142			map->m_pa = blknr_to_addr(le32_to_cpu(idx->blkaddr));
   143			map->m_flags = EROFS_MAP_MAPPED;
   144			break;
   145		}
   146	out_unlock:
   147		unlock_page(page);
   148		put_page(page);
   149	out:
   150		map->m_llen = map->m_plen;
   151		return err;
   152	}
   153	

---
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: 35663 bytes --]

                 reply	other threads:[~2021-08-16  1:37 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=202108160922.E6giy4cO-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=hsiangkao@linux.alibaba.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiang@kernel.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

all inboxes | Powered by JetHome®