From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [linux-next:master 7574/10945] fs/dax.c:1594:10: warning: Although the value stored to 'error' is used in the enclosing expression, the value is never actually read from 'error' [clang-analyzer-deadcode.DeadStores]
Date: Sat, 28 Aug 2021 15:12:37 +0800 [thread overview]
Message-ID: <202108281528.RdbzOKgi-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 21169 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: Christoph Hellwig <hch@lst.de>
CC: "Darrick J. Wong" <djwong@kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 5e63226c72287bc6c6724d4fc7e157af0e3d7908
commit: 65dd814a6187ff46e33718d8eb76244e027837a3 [7574/10945] fsdax: switch the fault handlers to use iomap_iter
:::::: branch date: 20 hours ago
:::::: commit date: 11 days ago
config: x86_64-randconfig-c007-20210827 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 1076082a0d97bd5c16a25ee7cf3dbb6ee4b5a9fe)
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://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=65dd814a6187ff46e33718d8eb76244e027837a3
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout 65dd814a6187ff46e33718d8eb76244e027837a3
# save the attached .config 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/err.h:22:34: note: expanded from macro 'IS_ERR_VALUE'
#define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
# define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
______r = __builtin_expect(!!(x), expect); \
^
include/linux/err.h:36:2: note: Returning zero, which participates in a condition later
return IS_ERR_VALUE((unsigned long)ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ntfs/dir.c:1222:6: note: Returning from 'IS_ERR'
if (IS_ERR(bmp_vi)) {
^~~~~~~~~~~~~~
fs/ntfs/dir.c:1222:2: note: Taking false branch
if (IS_ERR(bmp_vi)) {
^
fs/ntfs/dir.c:1230:15: note: Assuming the condition is false
if (unlikely(bmp_pos >> 3 >= i_size_read(bmp_vi))) {
^
include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
# define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
^
include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
______r = __builtin_expect(!!(x), expect); \
^
fs/ntfs/dir.c:1230:2: note: Taking false branch
if (unlikely(bmp_pos >> 3 >= i_size_read(bmp_vi))) {
^
fs/ntfs/dir.c:1245:6: note: Calling 'IS_ERR'
if (IS_ERR(bmp_page)) {
^~~~~~~~~~~~~~~~
include/linux/err.h:36:2: note: Returning zero, which participates in a condition later
return IS_ERR_VALUE((unsigned long)ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ntfs/dir.c:1245:6: note: Returning from 'IS_ERR'
if (IS_ERR(bmp_page)) {
^~~~~~~~~~~~~~~~
fs/ntfs/dir.c:1245:2: note: Taking false branch
if (IS_ERR(bmp_page)) {
^
fs/ntfs/dir.c:1253:2: note: Loop condition is false. Execution continues on line 1272
while (!(bmp[cur_bmp_pos >> 3] & (1 << (cur_bmp_pos & 7)))) {
^
fs/ntfs/dir.c:1275:6: note: Assuming the condition is false
if ((prev_ia_pos & (s64)PAGE_MASK) !=
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ntfs/dir.c:1275:2: note: Taking false branch
if ((prev_ia_pos & (s64)PAGE_MASK) !=
^
fs/ntfs/dir.c:1297:2: note: Null pointer value stored to 'ia'
ia = (INDEX_ALLOCATION*)(kaddr + (ia_pos & ~PAGE_MASK &
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ntfs/dir.c:1300:15: note: 'ia' is >= 'kaddr'
if (unlikely((u8*)ia < kaddr || (u8*)ia > kaddr + PAGE_SIZE)) {
^
include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
# define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
^
include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
______r = __builtin_expect(!!(x), expect); \
^
fs/ntfs/dir.c:1300:15: note: Left side of '||' is false
if (unlikely((u8*)ia < kaddr || (u8*)ia > kaddr + PAGE_SIZE)) {
^
fs/ntfs/dir.c:1300:15: note: 'ia' is >= 'kaddr'
include/linux/compiler.h:48:68: note: expanded from macro 'unlikely'
# define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
^
include/linux/compiler.h:35:19: note: expanded from macro '__branch_check__'
expect, is_constant); \
^~~~~~~~~~~
fs/ntfs/dir.c:1300:15: note: Left side of '||' is false
if (unlikely((u8*)ia < kaddr || (u8*)ia > kaddr + PAGE_SIZE)) {
^
fs/ntfs/dir.c:1300:2: note: Taking false branch
if (unlikely((u8*)ia < kaddr || (u8*)ia > kaddr + PAGE_SIZE)) {
^
fs/ntfs/dir.c:1306:36: note: Access to field 'magic' results in a dereference of a null pointer (loaded from variable 'ia')
if (unlikely(!ntfs_is_indx_record(ia->magic))) {
^
fs/ntfs/layout.h:139:50: note: expanded from macro 'ntfs_is_indx_record'
#define ntfs_is_indx_record(x) ( ntfs_is_magic (x, INDX) )
^
fs/ntfs/layout.h:124:45: note: expanded from macro 'ntfs_is_magic'
#define ntfs_is_magic(x, m) __ntfs_is_magic(x, magic_##m)
^
include/linux/compiler.h:48:41: note: expanded from macro 'unlikely'
# define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
^
include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__'
______r = __builtin_expect(!!(x), expect); \
^
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
>> fs/dax.c:1594:10: warning: Although the value stored to 'error' is used in the enclosing expression, the value is never actually read from 'error' [clang-analyzer-deadcode.DeadStores]
while ((error = iomap_iter(&iter, ops)) > 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~
fs/dax.c:1594:10: note: Although the value stored to 'error' is used in the enclosing expression, the value is never actually read from 'error'
while ((error = iomap_iter(&iter, ops)) > 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~
fs/dax.c:1709:25: warning: The result of the left shift is undefined due to shifting by '4294967295', which is greater or equal to the width of type 'unsigned long' [clang-analyzer-core.UndefinedBinaryOperatorResult]
size_t len = PAGE_SIZE << order;
^ ~~~~~
fs/dax.c:1708:23: note: Calling 'pe_order'
unsigned int order = pe_order(pe_size);
^~~~~~~~~~~~~~~~~
fs/dax.c:35:6: note: Assuming 'pe_size' is not equal to PE_SIZE_PTE
if (pe_size == PE_SIZE_PTE)
^~~~~~~~~~~~~~~~~~~~~~
fs/dax.c:35:2: note: Taking false branch
if (pe_size == PE_SIZE_PTE)
^
fs/dax.c:37:6: note: Assuming 'pe_size' is not equal to PE_SIZE_PMD
if (pe_size == PE_SIZE_PMD)
^~~~~~~~~~~~~~~~~~~~~~
fs/dax.c:37:2: note: Taking false branch
if (pe_size == PE_SIZE_PMD)
^
fs/dax.c:39:6: note: Assuming 'pe_size' is not equal to PE_SIZE_PUD
if (pe_size == PE_SIZE_PUD)
^~~~~~~~~~~~~~~~~~~~~~
fs/dax.c:39:2: note: Taking false branch
if (pe_size == PE_SIZE_PUD)
^
fs/dax.c:41:2: note: Returning the value 4294967295
return ~0;
^~~~~~~~~
fs/dax.c:1708:23: note: Returning from 'pe_order'
unsigned int order = pe_order(pe_size);
^~~~~~~~~~~~~~~~~
fs/dax.c:1708:2: note: 'order' initialized to 4294967295
unsigned int order = pe_order(pe_size);
^~~~~~~~~~~~~~~~~~
fs/dax.c:1709:25: note: The result of the left shift is undefined due to shifting by '4294967295', which is greater or equal to the width of type 'unsigned long'
size_t len = PAGE_SIZE << order;
^ ~~~~~
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
Suppressed 6 warnings (6 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
fs/crypto/fname.c:200:16: warning: The left operand of '<<' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
ac += src[i] << bits;
^
fs/crypto/fname.c:324:2: note: Taking false branch
if (fscrypt_is_dot_dotdot(&qname)) {
^
fs/crypto/fname.c:331:6: note: Assuming field 'len' is >= FS_CRYPTO_BLOCK_SIZE
if (iname->len < FS_CRYPTO_BLOCK_SIZE)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/crypto/fname.c:331:2: note: Taking false branch
if (iname->len < FS_CRYPTO_BLOCK_SIZE)
^
fs/crypto/fname.c:334:2: note: Taking false branch
if (fscrypt_has_encryption_key(inode))
^
fs/crypto/fname.c:341:2: note: Taking false branch
BUILD_BUG_ON(offsetofend(struct fscrypt_nokey_name, dirhash) !=
^
include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
fs/crypto/fname.c:341:2: note: Loop condition is false. Exiting loop
BUILD_BUG_ON(offsetofend(struct fscrypt_nokey_name, dirhash) !=
^
include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:306:2: note: expanded from macro '__compiletime_assert'
do { \
^
fs/crypto/fname.c:343:2: note: Taking false branch
BUILD_BUG_ON(offsetofend(struct fscrypt_nokey_name, bytes) !=
vim +1594 fs/dax.c
55f81639a71528 Shiyang Ruan 2021-08-10 1533
ab77dab46210bb Souptick Joarder 2018-06-07 1534 static vm_fault_t dax_iomap_pmd_fault(struct vm_fault *vmf, pfn_t *pfnp,
a2d581675d485e Dave Jiang 2017-02-24 1535 const struct iomap_ops *ops)
642261ac995e01 Ross Zwisler 2016-11-08 1536 {
65dd814a6187ff Christoph Hellwig 2021-08-10 1537 struct address_space *mapping = vmf->vma->vm_file->f_mapping;
b15cd800682fca Matthew Wilcox 2018-03-29 1538 XA_STATE_ORDER(xas, &mapping->i_pages, vmf->pgoff, PMD_ORDER);
65dd814a6187ff Christoph Hellwig 2021-08-10 1539 struct iomap_iter iter = {
65dd814a6187ff Christoph Hellwig 2021-08-10 1540 .inode = mapping->host,
65dd814a6187ff Christoph Hellwig 2021-08-10 1541 .len = PMD_SIZE,
65dd814a6187ff Christoph Hellwig 2021-08-10 1542 .flags = IOMAP_FAULT,
65dd814a6187ff Christoph Hellwig 2021-08-10 1543 };
c2436190e492b2 Shiyang Ruan 2021-08-10 1544 vm_fault_t ret = VM_FAULT_FALLBACK;
b15cd800682fca Matthew Wilcox 2018-03-29 1545 pgoff_t max_pgoff;
642261ac995e01 Ross Zwisler 2016-11-08 1546 void *entry;
642261ac995e01 Ross Zwisler 2016-11-08 1547 int error;
642261ac995e01 Ross Zwisler 2016-11-08 1548
65dd814a6187ff Christoph Hellwig 2021-08-10 1549 if (vmf->flags & FAULT_FLAG_WRITE)
65dd814a6187ff Christoph Hellwig 2021-08-10 1550 iter.flags |= IOMAP_WRITE;
65dd814a6187ff Christoph Hellwig 2021-08-10 1551
282a8e0391c377 Ross Zwisler 2017-02-22 1552 /*
282a8e0391c377 Ross Zwisler 2017-02-22 1553 * Check whether offset isn't beyond end of file now. Caller is
282a8e0391c377 Ross Zwisler 2017-02-22 1554 * supposed to hold locks serializing us with truncate / punch hole so
282a8e0391c377 Ross Zwisler 2017-02-22 1555 * this is a reliable test.
282a8e0391c377 Ross Zwisler 2017-02-22 1556 */
65dd814a6187ff Christoph Hellwig 2021-08-10 1557 max_pgoff = DIV_ROUND_UP(i_size_read(iter.inode), PAGE_SIZE);
282a8e0391c377 Ross Zwisler 2017-02-22 1558
65dd814a6187ff Christoph Hellwig 2021-08-10 1559 trace_dax_pmd_fault(iter.inode, vmf, max_pgoff, 0);
282a8e0391c377 Ross Zwisler 2017-02-22 1560
b15cd800682fca Matthew Wilcox 2018-03-29 1561 if (xas.xa_index >= max_pgoff) {
c2436190e492b2 Shiyang Ruan 2021-08-10 1562 ret = VM_FAULT_SIGBUS;
282a8e0391c377 Ross Zwisler 2017-02-22 1563 goto out;
282a8e0391c377 Ross Zwisler 2017-02-22 1564 }
642261ac995e01 Ross Zwisler 2016-11-08 1565
55f81639a71528 Shiyang Ruan 2021-08-10 1566 if (dax_fault_check_fallback(vmf, &xas, max_pgoff))
642261ac995e01 Ross Zwisler 2016-11-08 1567 goto fallback;
642261ac995e01 Ross Zwisler 2016-11-08 1568
876f29460cbd40 Ross Zwisler 2017-05-12 1569 /*
b15cd800682fca Matthew Wilcox 2018-03-29 1570 * grab_mapping_entry() will make sure we get an empty PMD entry,
b15cd800682fca Matthew Wilcox 2018-03-29 1571 * a zero PMD entry or a DAX PMD. If it can't (because a PTE
b15cd800682fca Matthew Wilcox 2018-03-29 1572 * entry is already in the array, for instance), it will return
b15cd800682fca Matthew Wilcox 2018-03-29 1573 * VM_FAULT_FALLBACK.
876f29460cbd40 Ross Zwisler 2017-05-12 1574 */
23c84eb7837514 Matthew Wilcox (Oracle 2019-07-03 1575) entry = grab_mapping_entry(&xas, mapping, PMD_ORDER);
b15cd800682fca Matthew Wilcox 2018-03-29 1576 if (xa_is_internal(entry)) {
c2436190e492b2 Shiyang Ruan 2021-08-10 1577 ret = xa_to_internal(entry);
876f29460cbd40 Ross Zwisler 2017-05-12 1578 goto fallback;
b15cd800682fca Matthew Wilcox 2018-03-29 1579 }
876f29460cbd40 Ross Zwisler 2017-05-12 1580
e2093926a098a8 Ross Zwisler 2017-06-02 1581 /*
e2093926a098a8 Ross Zwisler 2017-06-02 1582 * It is possible, particularly with mixed reads & writes to private
e2093926a098a8 Ross Zwisler 2017-06-02 1583 * mappings, that we have raced with a PTE fault that overlaps with
e2093926a098a8 Ross Zwisler 2017-06-02 1584 * the PMD we need to set up. If so just return and the fault will be
e2093926a098a8 Ross Zwisler 2017-06-02 1585 * retried.
e2093926a098a8 Ross Zwisler 2017-06-02 1586 */
e2093926a098a8 Ross Zwisler 2017-06-02 1587 if (!pmd_none(*vmf->pmd) && !pmd_trans_huge(*vmf->pmd) &&
e2093926a098a8 Ross Zwisler 2017-06-02 1588 !pmd_devmap(*vmf->pmd)) {
c2436190e492b2 Shiyang Ruan 2021-08-10 1589 ret = 0;
e2093926a098a8 Ross Zwisler 2017-06-02 1590 goto unlock_entry;
e2093926a098a8 Ross Zwisler 2017-06-02 1591 }
e2093926a098a8 Ross Zwisler 2017-06-02 1592
65dd814a6187ff Christoph Hellwig 2021-08-10 1593 iter.pos = (loff_t)xas.xa_index << PAGE_SHIFT;
65dd814a6187ff Christoph Hellwig 2021-08-10 @1594 while ((error = iomap_iter(&iter, ops)) > 0) {
65dd814a6187ff Christoph Hellwig 2021-08-10 1595 if (iomap_length(&iter) < PMD_SIZE)
65dd814a6187ff Christoph Hellwig 2021-08-10 1596 continue; /* actually breaks out of the loop */
642261ac995e01 Ross Zwisler 2016-11-08 1597
65dd814a6187ff Christoph Hellwig 2021-08-10 1598 ret = dax_fault_iter(vmf, &iter, pfnp, &xas, &entry, true);
65dd814a6187ff Christoph Hellwig 2021-08-10 1599 if (ret != VM_FAULT_FALLBACK)
65dd814a6187ff Christoph Hellwig 2021-08-10 1600 iter.processed = PMD_SIZE;
642261ac995e01 Ross Zwisler 2016-11-08 1601 }
65dd814a6187ff Christoph Hellwig 2021-08-10 1602
876f29460cbd40 Ross Zwisler 2017-05-12 1603 unlock_entry:
b15cd800682fca Matthew Wilcox 2018-03-29 1604 dax_unlock_entry(&xas, entry);
642261ac995e01 Ross Zwisler 2016-11-08 1605 fallback:
c2436190e492b2 Shiyang Ruan 2021-08-10 1606 if (ret == VM_FAULT_FALLBACK) {
65dd814a6187ff Christoph Hellwig 2021-08-10 1607 split_huge_pmd(vmf->vma, vmf->pmd, vmf->address);
642261ac995e01 Ross Zwisler 2016-11-08 1608 count_vm_event(THP_FAULT_FALLBACK);
642261ac995e01 Ross Zwisler 2016-11-08 1609 }
282a8e0391c377 Ross Zwisler 2017-02-22 1610 out:
65dd814a6187ff Christoph Hellwig 2021-08-10 1611 trace_dax_pmd_fault_done(iter.inode, vmf, max_pgoff, ret);
c2436190e492b2 Shiyang Ruan 2021-08-10 1612 return ret;
642261ac995e01 Ross Zwisler 2016-11-08 1613 }
a2d581675d485e Dave Jiang 2017-02-24 1614 #else
ab77dab46210bb Souptick Joarder 2018-06-07 1615 static vm_fault_t dax_iomap_pmd_fault(struct vm_fault *vmf, pfn_t *pfnp,
01cddfe99008da Arnd Bergmann 2017-02-27 1616 const struct iomap_ops *ops)
a2d581675d485e Dave Jiang 2017-02-24 1617 {
a2d581675d485e Dave Jiang 2017-02-24 1618 return VM_FAULT_FALLBACK;
a2d581675d485e Dave Jiang 2017-02-24 1619 }
642261ac995e01 Ross Zwisler 2016-11-08 1620 #endif /* CONFIG_FS_DAX_PMD */
a2d581675d485e Dave Jiang 2017-02-24 1621
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 35946 bytes --]
reply other threads:[~2021-08-28 7:12 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=202108281528.RdbzOKgi-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.