From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [kdave-btrfs-devel:for-next-20220120 42/50] fs/btrfs/inode.c:10433:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
Date: Tue, 25 Jan 2022 23:24:27 +0800 [thread overview]
Message-ID: <202201252344.ipCK5rkS-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 18265 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Omar Sandoval <osandov@fb.com>
CC: David Sterba <dsterba@suse.com>
tree: https://github.com/kdave/btrfs-devel.git for-next-20220120
head: 6fb735a475ecc1022d6f3013418f4ca597eb80fb
commit: dfd0277dca6c45b201724f16417e49f638bd04b4 [42/50] btrfs: add BTRFS_IOC_ENCODED_READ
:::::: branch date: 5 days ago
:::::: commit date: 5 days ago
config: x86_64-randconfig-c007-20220124 (https://download.01.org/0day-ci/archive/20220125/202201252344.ipCK5rkS-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 997e128e2a78f5a5434fc75997441ae1ee76f8a4)
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
# https://github.com/kdave/btrfs-devel/commit/dfd0277dca6c45b201724f16417e49f638bd04b4
git remote add kdave-btrfs-devel https://github.com/kdave/btrfs-devel.git
git fetch --no-tags kdave-btrfs-devel for-next-20220120
git checkout dfd0277dca6c45b201724f16417e49f638bd04b4
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^
include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
__cmp(unique_x, unique_y, op); })
^
include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
#define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
^
fs/btrfs/inode.c:7606:6: note: 'write' is true
if (write) {
^~~~~
fs/btrfs/inode.c:7606:2: note: Taking true branch
if (write) {
^
fs/btrfs/inode.c:7607:9: note: Calling 'btrfs_get_blocks_direct_write'
ret = btrfs_get_blocks_direct_write(&em, inode, dio_data,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:7427:6: note: Assuming the condition is false
if (test_bit(EXTENT_FLAG_PREALLOC, &em->flags) ||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:7427:6: note: Left side of '||' is false
fs/btrfs/inode.c:7428:8: note: Assuming the condition is false
((BTRFS_I(inode)->flags & BTRFS_INODE_NODATACOW) &&
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:7428:55: note: Left side of '&&' is false
((BTRFS_I(inode)->flags & BTRFS_INODE_NODATACOW) &&
^
fs/btrfs/inode.c:7443:6: note: 'can_nocow' is false
if (can_nocow) {
^~~~~~~~~
fs/btrfs/inode.c:7443:2: note: Taking false branch
if (can_nocow) {
^
fs/btrfs/inode.c:7476:3: note: Null pointer value stored to 'em'
*map = NULL;
^~~~~~~~~~~
fs/btrfs/inode.c:7482:7: note: Assuming 'ret' is >= 0
if (ret < 0)
^~~~~~~
fs/btrfs/inode.c:7482:3: note: Taking false branch
if (ret < 0)
^
fs/btrfs/inode.c:7487:3: note: Taking true branch
if (IS_ERR(em)) {
^
fs/btrfs/inode.c:7489:4: note: Control jumps to line 7513
goto out;
^
fs/btrfs/inode.c:7513:6: note: Assuming 'ret' is 0
if (ret && space_reserved) {
^~~
fs/btrfs/inode.c:7513:10: note: Left side of '&&' is false
if (ret && space_reserved) {
^
fs/btrfs/inode.c:7607:9: note: Returning from 'btrfs_get_blocks_direct_write'
ret = btrfs_get_blocks_direct_write(&em, inode, dio_data,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:7609:7: note: 'ret' is >= 0
if (ret < 0)
^~~
fs/btrfs/inode.c:7609:3: note: Taking false branch
if (ret < 0)
^
fs/btrfs/inode.c:7613:18: note: Access to field 'len' results in a dereference of a null pointer (loaded from variable 'em')
len = min(len, em->len - (start - em->start));
^
include/linux/minmax.h:45:36: note: expanded from macro 'min'
#define min(x, y) __careful_cmp(x, y, <)
^
include/linux/minmax.h:38:17: note: expanded from macro '__careful_cmp'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^
include/linux/minmax.h:32:25: note: expanded from macro '__cmp_once'
typeof(y) unique_y = (y); \
^
fs/btrfs/inode.c:9227:4: warning: Value stored to 'root_log_pinned' is never read [clang-analyzer-deadcode.DeadStores]
root_log_pinned = false;
^ ~~~~~
fs/btrfs/inode.c:9227:4: note: Value stored to 'root_log_pinned' is never read
root_log_pinned = false;
^ ~~~~~
fs/btrfs/inode.c:9231:4: warning: Value stored to 'dest_log_pinned' is never read [clang-analyzer-deadcode.DeadStores]
dest_log_pinned = false;
^ ~~~~~
fs/btrfs/inode.c:9231:4: note: Value stored to 'dest_log_pinned' is never read
dest_log_pinned = false;
^ ~~~~~
fs/btrfs/inode.c:9347:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = 0;
^ ~
fs/btrfs/inode.c:9347:2: note: Value stored to 'ret' is never read
ret = 0;
^ ~
fs/btrfs/inode.c:9518:3: warning: Value stored to 'log_pinned' is never read [clang-analyzer-deadcode.DeadStores]
log_pinned = false;
^ ~~~~~
fs/btrfs/inode.c:9518:3: note: Value stored to 'log_pinned' is never read
log_pinned = false;
^ ~~~~~
>> fs/btrfs/inode.c:10433:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
remaining = min(geom.len, disk_io_size - cur);
^
include/linux/minmax.h:45:19: note: expanded from macro 'min'
#define min(x, y) __careful_cmp(x, y, <)
^
include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^
include/linux/minmax.h:31:3: note: expanded from macro '__cmp_once'
typeof(x) unique_x = (x); \
^
fs/btrfs/inode.c:10559:6: note: Assuming field 'ki_pos' is < field 'i_size'
if (iocb->ki_pos >= inode->i_size) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:10559:2: note: Taking false branch
if (iocb->ki_pos >= inode->i_size) {
^
fs/btrfs/inode.c:10570:2: note: Loop condition is true. Entering loop body
for (;;) {
^
fs/btrfs/inode.c:10575:7: note: Assuming 'ret' is 0
if (ret)
^~~
fs/btrfs/inode.c:10575:3: note: Taking false branch
if (ret)
^
fs/btrfs/inode.c:10580:7: note: Assuming 'ordered' is null
if (!ordered)
^~~~~~~~
fs/btrfs/inode.c:10580:3: note: Taking true branch
if (!ordered)
^
fs/btrfs/inode.c:10581:4: note: Execution continues on line 10587
break;
^
fs/btrfs/inode.c:10589:2: note: Taking false branch
if (IS_ERR(em)) {
^
fs/btrfs/inode.c:10594:6: note: Assuming the condition is false
if (em->block_start == EXTENT_MAP_INLINE) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:10594:2: note: Taking false branch
if (em->block_start == EXTENT_MAP_INLINE) {
^
fs/btrfs/inode.c:10613:18: note: '__UNIQUE_ID___x1569' is >= '__UNIQUE_ID___y1570'
encoded->len = (min_t(u64, extent_map_end(em), inode->i_size) -
^
include/linux/minmax.h:104:27: note: expanded from macro 'min_t'
#define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
__cmp(unique_x, unique_y, op); })
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
#define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
^~~
fs/btrfs/inode.c:10613:18: note: '?' condition is false
encoded->len = (min_t(u64, extent_map_end(em), inode->i_size) -
^
include/linux/minmax.h:104:27: note: expanded from macro 'min_t'
#define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
^
include/linux/minmax.h:38:3: note: expanded from macro '__careful_cmp'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^
include/linux/minmax.h:33:3: note: expanded from macro '__cmp_once'
__cmp(unique_x, unique_y, op); })
^
include/linux/minmax.h:28:26: note: expanded from macro '__cmp'
#define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
^
fs/btrfs/inode.c:10615:6: note: Assuming the condition is false
if (em->block_start == EXTENT_MAP_HOLE ||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:10615:6: note: Left side of '||' is false
fs/btrfs/inode.c:10616:6: note: Assuming the condition is false
test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:10615:2: note: Taking false branch
if (em->block_start == EXTENT_MAP_HOLE ||
^
fs/btrfs/inode.c:10620:13: note: Assuming the condition is true
} else if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:10620:9: note: Taking true branch
} else if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) {
^
fs/btrfs/inode.c:10626:7: note: Assuming 'count' is >= field 'block_len'
if (em->block_len > count) {
^~~~~~~~~~~~~~~~~~~~~
fs/btrfs/inode.c:10626:3: note: Taking false branch
if (em->block_len > count) {
^
fs/btrfs/inode.c:10635:7: note: 'ret' is >= 0
if (ret < 0)
^~~
fs/btrfs/inode.c:10635:3: note: Taking false branch
vim +10433 fs/btrfs/inode.c
dfd0277dca6c45 Omar Sandoval 2021-11-17 10391
dfd0277dca6c45 Omar Sandoval 2021-11-17 10392 static int btrfs_encoded_read_regular_fill_pages(struct inode *inode,
dfd0277dca6c45 Omar Sandoval 2021-11-17 10393 u64 file_offset,
dfd0277dca6c45 Omar Sandoval 2021-11-17 10394 u64 disk_bytenr,
dfd0277dca6c45 Omar Sandoval 2021-11-17 10395 u64 disk_io_size,
dfd0277dca6c45 Omar Sandoval 2021-11-17 10396 struct page **pages)
dfd0277dca6c45 Omar Sandoval 2021-11-17 10397 {
dfd0277dca6c45 Omar Sandoval 2021-11-17 10398 struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
dfd0277dca6c45 Omar Sandoval 2021-11-17 10399 struct btrfs_encoded_read_private priv = {
dfd0277dca6c45 Omar Sandoval 2021-11-17 10400 .inode = inode,
dfd0277dca6c45 Omar Sandoval 2021-11-17 10401 .file_offset = file_offset,
dfd0277dca6c45 Omar Sandoval 2021-11-17 10402 .pending = ATOMIC_INIT(1),
dfd0277dca6c45 Omar Sandoval 2021-11-17 10403 .skip_csum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM,
dfd0277dca6c45 Omar Sandoval 2021-11-17 10404 };
dfd0277dca6c45 Omar Sandoval 2021-11-17 10405 unsigned long i = 0;
dfd0277dca6c45 Omar Sandoval 2021-11-17 10406 u64 cur = 0;
dfd0277dca6c45 Omar Sandoval 2021-11-17 10407 int ret;
dfd0277dca6c45 Omar Sandoval 2021-11-17 10408
dfd0277dca6c45 Omar Sandoval 2021-11-17 10409 init_waitqueue_head(&priv.wait);
dfd0277dca6c45 Omar Sandoval 2021-11-17 10410 /*
dfd0277dca6c45 Omar Sandoval 2021-11-17 10411 * Submit bios for the extent, splitting due to bio or stripe limits as
dfd0277dca6c45 Omar Sandoval 2021-11-17 10412 * necessary.
dfd0277dca6c45 Omar Sandoval 2021-11-17 10413 */
dfd0277dca6c45 Omar Sandoval 2021-11-17 10414 while (cur < disk_io_size) {
dfd0277dca6c45 Omar Sandoval 2021-11-17 10415 struct extent_map *em;
dfd0277dca6c45 Omar Sandoval 2021-11-17 10416 struct btrfs_io_geometry geom;
dfd0277dca6c45 Omar Sandoval 2021-11-17 10417 struct bio *bio = NULL;
dfd0277dca6c45 Omar Sandoval 2021-11-17 10418 u64 remaining;
dfd0277dca6c45 Omar Sandoval 2021-11-17 10419
dfd0277dca6c45 Omar Sandoval 2021-11-17 10420 em = btrfs_get_chunk_map(fs_info, disk_bytenr + cur,
dfd0277dca6c45 Omar Sandoval 2021-11-17 10421 disk_io_size - cur);
dfd0277dca6c45 Omar Sandoval 2021-11-17 10422 if (IS_ERR(em)) {
dfd0277dca6c45 Omar Sandoval 2021-11-17 10423 ret = PTR_ERR(em);
dfd0277dca6c45 Omar Sandoval 2021-11-17 10424 } else {
dfd0277dca6c45 Omar Sandoval 2021-11-17 10425 ret = btrfs_get_io_geometry(fs_info, em, BTRFS_MAP_READ,
dfd0277dca6c45 Omar Sandoval 2021-11-17 10426 disk_bytenr + cur, &geom);
dfd0277dca6c45 Omar Sandoval 2021-11-17 10427 free_extent_map(em);
dfd0277dca6c45 Omar Sandoval 2021-11-17 10428 }
dfd0277dca6c45 Omar Sandoval 2021-11-17 10429 if (ret) {
dfd0277dca6c45 Omar Sandoval 2021-11-17 10430 WRITE_ONCE(priv.status, errno_to_blk_status(ret));
dfd0277dca6c45 Omar Sandoval 2021-11-17 10431 break;
dfd0277dca6c45 Omar Sandoval 2021-11-17 10432 }
dfd0277dca6c45 Omar Sandoval 2021-11-17 @10433 remaining = min(geom.len, disk_io_size - cur);
dfd0277dca6c45 Omar Sandoval 2021-11-17 10434 while (bio || remaining) {
dfd0277dca6c45 Omar Sandoval 2021-11-17 10435 size_t bytes = min_t(u64, remaining, PAGE_SIZE);
dfd0277dca6c45 Omar Sandoval 2021-11-17 10436
dfd0277dca6c45 Omar Sandoval 2021-11-17 10437 if (!bio) {
dfd0277dca6c45 Omar Sandoval 2021-11-17 10438 bio = btrfs_bio_alloc(BIO_MAX_VECS);
dfd0277dca6c45 Omar Sandoval 2021-11-17 10439 bio->bi_iter.bi_sector =
dfd0277dca6c45 Omar Sandoval 2021-11-17 10440 (disk_bytenr + cur) >> SECTOR_SHIFT;
dfd0277dca6c45 Omar Sandoval 2021-11-17 10441 bio->bi_end_io = btrfs_encoded_read_endio;
dfd0277dca6c45 Omar Sandoval 2021-11-17 10442 bio->bi_private = &priv;
dfd0277dca6c45 Omar Sandoval 2021-11-17 10443 bio->bi_opf = REQ_OP_READ;
dfd0277dca6c45 Omar Sandoval 2021-11-17 10444 }
dfd0277dca6c45 Omar Sandoval 2021-11-17 10445
dfd0277dca6c45 Omar Sandoval 2021-11-17 10446 if (!bytes ||
dfd0277dca6c45 Omar Sandoval 2021-11-17 10447 bio_add_page(bio, pages[i], bytes, 0) < bytes) {
dfd0277dca6c45 Omar Sandoval 2021-11-17 10448 blk_status_t status;
dfd0277dca6c45 Omar Sandoval 2021-11-17 10449
dfd0277dca6c45 Omar Sandoval 2021-11-17 10450 status = submit_encoded_read_bio(inode, bio, 0,
dfd0277dca6c45 Omar Sandoval 2021-11-17 10451 0);
dfd0277dca6c45 Omar Sandoval 2021-11-17 10452 if (status) {
dfd0277dca6c45 Omar Sandoval 2021-11-17 10453 WRITE_ONCE(priv.status, status);
dfd0277dca6c45 Omar Sandoval 2021-11-17 10454 bio_put(bio);
dfd0277dca6c45 Omar Sandoval 2021-11-17 10455 goto out;
dfd0277dca6c45 Omar Sandoval 2021-11-17 10456 }
dfd0277dca6c45 Omar Sandoval 2021-11-17 10457 bio = NULL;
dfd0277dca6c45 Omar Sandoval 2021-11-17 10458 continue;
dfd0277dca6c45 Omar Sandoval 2021-11-17 10459 }
dfd0277dca6c45 Omar Sandoval 2021-11-17 10460
dfd0277dca6c45 Omar Sandoval 2021-11-17 10461 i++;
dfd0277dca6c45 Omar Sandoval 2021-11-17 10462 cur += bytes;
dfd0277dca6c45 Omar Sandoval 2021-11-17 10463 remaining -= bytes;
dfd0277dca6c45 Omar Sandoval 2021-11-17 10464 }
dfd0277dca6c45 Omar Sandoval 2021-11-17 10465 }
dfd0277dca6c45 Omar Sandoval 2021-11-17 10466
dfd0277dca6c45 Omar Sandoval 2021-11-17 10467 out:
dfd0277dca6c45 Omar Sandoval 2021-11-17 10468 if (atomic_dec_return(&priv.pending))
dfd0277dca6c45 Omar Sandoval 2021-11-17 10469 io_wait_event(priv.wait, !atomic_read(&priv.pending));
dfd0277dca6c45 Omar Sandoval 2021-11-17 10470 /* See btrfs_encoded_read_endio() for ordering. */
dfd0277dca6c45 Omar Sandoval 2021-11-17 10471 return blk_status_to_errno(READ_ONCE(priv.status));
dfd0277dca6c45 Omar Sandoval 2021-11-17 10472 }
dfd0277dca6c45 Omar Sandoval 2021-11-17 10473
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
reply other threads:[~2022-01-25 15:24 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=202201252344.ipCK5rkS-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.