lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Mon, 26 Jul 2021 11:42:24 +0800
From:   kernel test robot <rong.a.chen@...el.com>
To:     Wang Jianchao <jianchao.wan9@...il.com>,
        linux-ext4@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Cc:     kbuild-all@...ts.01.org, tytso@....edu, adilger.kernel@...ger.ca
Subject: Re: [PATCH V3 2/5] ext4: add new helper interface
 ext4_try_to_trim_range()

Hi Wang,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on ext4/dev]
[also build test WARNING on linux/master linus/master v5.14-rc2 
next-20210723]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: 
https://github.com/0day-ci/linux/commits/Wang-Jianchao/ext4-get-discard-out-of-jbd2-commit-context/20210724-154426
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
:::::: branch date: 25 hours ago
:::::: commit date: 25 hours ago
config: x86_64-randconfig-c001-20210725 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 
c63dbd850182797bc4b76124d08e1c320ab2365d)
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
         # install x86_64 cross compiling tool for clang build
         # apt-get install binutils-x86-64-linux-gnu
         # 
https://github.com/0day-ci/linux/commit/55a3430685e83709742c1fe2e0d4b347781bcc80
         git remote add linux-review https://github.com/0day-ci/linux
         git fetch --no-tags linux-review 
Wang-Jianchao/ext4-get-discard-out-of-jbd2-commit-context/20210724-154426
         git checkout 55a3430685e83709742c1fe2e0d4b347781bcc80
         # save the attached .config to linux build tree
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross 
clang-analyzer ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>


clang-analyzer warnings: (new ones prefixed by >>)
    fs/ext4/mballoc.c:1909:2: note: Taking true branch
            if (ex->fe_start + ex->fe_len > 
EXT4_CLUSTERS_PER_GROUP(e4b->bd_sb)) {
            ^
    fs/ext4/mballoc.c:1911:3: note: Taking true branch
                    WARN_ON(1);
                    ^
    include/asm-generic/bug.h:120:2: note: expanded from macro 'WARN_ON'
            if (unlikely(__ret_warn_on)) 
     \
            ^
    fs/ext4/mballoc.c:1911:3: note: Loop condition is false.  Exiting loop
                    WARN_ON(1);
                    ^
    include/asm-generic/bug.h:121:3: note: expanded from macro 'WARN_ON'
                    __WARN(); 
     \
                    ^
    include/asm-generic/bug.h:94:19: note: expanded from macro '__WARN'
    #define __WARN()                __WARN_FLAGS(BUGFLAG_TAINT(TAINT_WARN))
                                    ^
    arch/x86/include/asm/bug.h:78:2: note: expanded from macro 
'__WARN_FLAGS'
            instrumentation_begin();                                \
            ^
    include/linux/instrumentation.h:53:34: note: expanded from macro 
'instrumentation_begin'
    # define instrumentation_begin()        do { } while(0)
                                            ^
    fs/ext4/mballoc.c:1911:3: note: Loop condition is false.  Exiting loop
                    WARN_ON(1);
                    ^
    include/asm-generic/bug.h:121:3: note: expanded from macro 'WARN_ON'
                    __WARN(); 
     \
                    ^
    include/asm-generic/bug.h:94:19: note: expanded from macro '__WARN'
    #define __WARN()                __WARN_FLAGS(BUGFLAG_TAINT(TAINT_WARN))
                                    ^
    arch/x86/include/asm/bug.h:79:2: note: expanded from macro 
'__WARN_FLAGS'
            _BUG_FLAGS(ASM_UD2, BUGFLAG_WARNING|(flags));           \
            ^
    arch/x86/include/asm/bug.h:25:37: note: expanded from macro '_BUG_FLAGS'
    #define _BUG_FLAGS(ins, flags) 
     \
 
     ^
    fs/ext4/mballoc.c:1911:3: note: Loop condition is false.  Exiting loop
                    WARN_ON(1);
                    ^
    include/asm-generic/bug.h:121:3: note: expanded from macro 'WARN_ON'
                    __WARN(); 
     \
                    ^
    include/asm-generic/bug.h:94:19: note: expanded from macro '__WARN'
    #define __WARN()                __WARN_FLAGS(BUGFLAG_TAINT(TAINT_WARN))
                                    ^
    arch/x86/include/asm/bug.h:81:2: note: expanded from macro 
'__WARN_FLAGS'
            instrumentation_end();                                  \
            ^
    include/linux/instrumentation.h:54:33: note: expanded from macro 
'instrumentation_end'
    # define instrumentation_end()          do { } while(0)
                                            ^
    fs/ext4/mballoc.c:1911:3: note: Loop condition is false.  Exiting loop
                    WARN_ON(1);
                    ^
    include/asm-generic/bug.h:121:3: note: expanded from macro 'WARN_ON'
                    __WARN(); 
     \
                    ^
    include/asm-generic/bug.h:94:19: note: expanded from macro '__WARN'
    #define __WARN()                __WARN_FLAGS(BUGFLAG_TAINT(TAINT_WARN))
                                    ^
    arch/x86/include/asm/bug.h:76:33: note: expanded from macro 
'__WARN_FLAGS'
    #define __WARN_FLAGS(flags)                                     \
                                                                    ^
    fs/ext4/mballoc.c:1912:3: note: 14th function call argument is an 
uninitialized value
                    ext4_grp_locked_error(e4b->bd_sb, e4b->bd_group, 0, 0,
                    ^
    fs/ext4/ext4.h:3126:2: note: expanded from macro 'ext4_grp_locked_error'
            __ext4_grp_locked_error(__func__, __LINE__, sb, grp, ino, 
block, \
            ^
    fs/ext4/mballoc.c:2597:27: warning: Value stored to 'grp' during its 
initialization is never read [clang-analyzer-deadcode.DeadStores]
                    struct ext4_group_info *grp = 
ext4_get_group_info(sb, group);
                                            ^~~ 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    fs/ext4/mballoc.c:2597:27: note: Value stored to 'grp' during its 
initialization is never read
                    struct ext4_group_info *grp = 
ext4_get_group_info(sb, group);
                                            ^~~ 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    fs/ext4/mballoc.c:3839:3: warning: Value stored to 'err' is never 
read [clang-analyzer-deadcode.DeadStores]
                    err = PTR_ERR(bitmap_bh);
                    ^     ~~~~~~~~~~~~~~~~~~
    fs/ext4/mballoc.c:3839:3: note: Value stored to 'err' is never read
                    err = PTR_ERR(bitmap_bh);
                    ^     ~~~~~~~~~~~~~~~~~~
    fs/ext4/mballoc.c:3844:2: warning: Value stored to 'err' is never 
read [clang-analyzer-deadcode.DeadStores]
            err = -EIO;
            ^     ~~~~
    fs/ext4/mballoc.c:3844:2: note: Value stored to 'err' is never read
            err = -EIO;
            ^     ~~~~
    fs/ext4/mballoc.c:3889:2: warning: Value stored to 'err' is never 
read [clang-analyzer-deadcode.DeadStores]
            err = ext4_handle_dirty_metadata(NULL, NULL, gdp_bh);
            ^
    fs/ext4/mballoc.c:3889:2: note: Value stored to 'err' is never read
    fs/ext4/mballoc.c:5746:3: warning: Value stored to 'err' is never 
read [clang-analyzer-deadcode.DeadStores]
                    err = PTR_ERR(bitmap_bh);
                    ^     ~~~~~~~~~~~~~~~~~~
    fs/ext4/mballoc.c:5746:3: note: Value stored to 'err' is never read
                    err = PTR_ERR(bitmap_bh);
                    ^     ~~~~~~~~~~~~~~~~~~
>> fs/ext4/mballoc.c:6245:4: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
                            ret = 0;
                            ^     ~
    fs/ext4/mballoc.c:6245:4: note: Value stored to 'ret' is never read
                            ret = 0;
                            ^     ~
    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.
    4 warnings generated.
    Suppressed 4 warnings (4 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.
    12 warnings generated.
    arch/x86/include/asm/paravirt.h:585:2: warning: Assigned value is 
garbage or undefined [clang-analyzer-core.uninitialized.Assign]
            PVOP_VCALL2(lock.queued_spin_lock_slowpath, lock, val);
            ^
    arch/x86/include/asm/paravirt_types.h:547:2: note: expanded from 
macro 'PVOP_VCALL2'
            __PVOP_VCALL(op, PVOP_CALL_ARG1(arg1), PVOP_CALL_ARG2(arg2))
            ^
    arch/x86/include/asm/paravirt_types.h:491:8: note: expanded from 
macro '__PVOP_VCALL'
            (void)____PVOP_CALL(, op, CLBR_ANY, PVOP_VCALL_CLOBBERS, 
     \
                  ^
    arch/x86/include/asm/paravirt_types.h:446:3: note: expanded from 
macro '____PVOP_CALL'
                    PVOP_CALL_ARGS; 
     \
                    ^
    arch/x86/include/asm/paravirt_types.h:404:16: note: expanded from 
macro 'PVOP_CALL_ARGS'
            unsigned long __edi = __edi, __esi = __esi,             \
                          ^
    kernel/trace/trace.c:5779:2: note: Calling 'queued_spin_lock'
            arch_spin_lock(&trace_cmdline_lock);
            ^
    include/asm-generic/qspinlock.h:117:28: note: expanded from macro 
'arch_spin_lock'
    #define arch_spin_lock(l)               queued_spin_lock(l)
                                            ^~~~~~~~~~~~~~~~~~~
    include/asm-generic/qspinlock.h:82:6: note: Assuming the condition 
is false
            if (likely(atomic_try_cmpxchg_acquire(&lock->val, &val, 
_Q_LOCKED_VAL)))
                ^
    include/linux/compiler.h:77:20: note: expanded from macro 'likely'
    # define likely(x)      __builtin_expect(!!(x), 1)
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
    include/asm-generic/qspinlock.h:82:2: note: Taking false branch
            if (likely(atomic_try_cmpxchg_acquire(&lock->val, &val, 
_Q_LOCKED_VAL)))
            ^
    include/asm-generic/qspinlock.h:85:2: note: Calling 
'queued_spin_lock_slowpath'
            queued_spin_lock_slowpath(lock, val);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/include/asm/qspinlock.h:51:2: note: Calling 
'pv_queued_spin_lock_slowpath'
            pv_queued_spin_lock_slowpath(lock, val);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/include/asm/paravirt.h:585:2: note: Assigned value is 
garbage or undefined
            PVOP_VCALL2(lock.queued_spin_lock_slowpath, lock, val);
            ^
    arch/x86/include/asm/paravirt_types.h:547:2: note: expanded from 
macro 'PVOP_VCALL2'
            __PVOP_VCALL(op, PVOP_CALL_ARG1(arg1), PVOP_CALL_ARG2(arg2))
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/include/asm/paravirt_types.h:491:8: note: expanded from 
macro '__PVOP_VCALL'
            (void)____PVOP_CALL(, op, CLBR_ANY, PVOP_VCALL_CLOBBERS, 
     \
 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    arch/x86/include/asm/paravirt_types.h:446:3: note: expanded from 
macro '____PVOP_CALL'
                    PVOP_CALL_ARGS; 
     \
                    ^~~~~~~~~~~~~~
    arch/x86/include/asm/paravirt_types.h:404:16: note: expanded from 
macro 'PVOP_CALL_ARGS'
            unsigned long __edi = __edi, __esi = __esi,             \
                          ^       ~~~~~
    arch/x86/include/asm/paravirt.h:590:2: warning: Assigned value is 
garbage or undefined [clang-analyzer-core.uninitialized.Assign]
            PVOP_ALT_VCALLEE1(lock.queued_spin_unlock, lock,
            ^
    arch/x86/include/asm/paravirt_types.h:541:2: note: expanded from 
macro 'PVOP_ALT_VCALLEE1'
            __PVOP_ALT_VCALLEESAVE(op, alt, cond, PVOP_CALL_ARG1(arg1))
            ^
    arch/x86/include/asm/paravirt_types.h:504:8: note: expanded from 
macro '__PVOP_ALT_VCALLEESAVE'
            (void)____PVOP_ALT_CALL(, op.func, alt, cond, CLBR_RET_REG, 
     \
                  ^
    arch/x86/include/asm/paravirt_types.h:460:3: note: expanded from 
macro '____PVOP_ALT_CALL'
                    PVOP_CALL_ARGS; 
     \
                    ^
    arch/x86/include/asm/paravirt_types.h:404:16: note: expanded from 
macro 'PVOP_CALL_ARGS'
            unsigned long __edi = __edi, __esi = __esi,             \
                          ^
    kernel/trace/trace.c:9948:6: note: Assuming 'tracepoint_printk' is 0
            if (tracepoint_printk) {
                ^~~~~~~~~~~~~~~~~
    kernel/trace/trace.c:9948:2: note: Taking false branch
            if (tracepoint_printk) {
            ^
    kernel/trace/trace.c:9957:2: note: Calling 'tracer_alloc_buffers'
            tracer_alloc_buffers();
            ^~~~~~~~~~~~~~~~~~~~~~
    kernel/trace/trace.c:9821:6: note: Assuming the condition is false
            if (security_locked_down(LOCKDOWN_TRACEFS)) {
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    kernel/trace/trace.c:9821:2: note: Taking false branch
            if (security_locked_down(LOCKDOWN_TRACEFS)) {
            ^
    kernel/trace/trace.c:9830:15: note: TRACE_ITER_LAST_BIT is <= 32
            BUILD_BUG_ON(TRACE_ITER_LAST_BIT > TRACE_FLAGS_MAX_SIZE);
                         ^
    include/linux/build_bug.h:50:19: note: expanded from macro 
'BUILD_BUG_ON'
            BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
                             ^~~~~~~~~
    include/linux/build_bug.h:39:58: note: expanded from macro 
'BUILD_BUG_ON_MSG'
    #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)

vim +/ret +6245 fs/ext4/mballoc.c

7360d1731e5dc7 Lukas Czerner 2010-10-27  6220  55a3430685e837 Wang 
Jianchao 2021-07-24  6221  static int ext4_try_to_trim_range(struct 
super_block *sb,
55a3430685e837 Wang Jianchao 2021-07-24  6222  		struct ext4_buddy *e4b, 
ext4_grpblk_t start,
55a3430685e837 Wang Jianchao 2021-07-24  6223  		ext4_grpblk_t max, 
ext4_grpblk_t minblocks)
55a3430685e837 Wang Jianchao 2021-07-24  6224  {
55a3430685e837 Wang Jianchao 2021-07-24  6225  	ext4_grpblk_t next, 
count, free_count;
55a3430685e837 Wang Jianchao 2021-07-24  6226  	void *bitmap;
55a3430685e837 Wang Jianchao 2021-07-24  6227  	int ret = 0;
55a3430685e837 Wang Jianchao 2021-07-24  6228  55a3430685e837 Wang 
Jianchao 2021-07-24  6229  	bitmap = e4b->bd_bitmap;
55a3430685e837 Wang Jianchao 2021-07-24  6230  	start = 
(e4b->bd_info->bb_first_free > start) ?
55a3430685e837 Wang Jianchao 2021-07-24  6231  	 
e4b->bd_info->bb_first_free : start;
55a3430685e837 Wang Jianchao 2021-07-24  6232  	count = 0;
55a3430685e837 Wang Jianchao 2021-07-24  6233  	free_count = 0;
55a3430685e837 Wang Jianchao 2021-07-24  6234  55a3430685e837 Wang 
Jianchao 2021-07-24  6235  	while (start <= max) {
55a3430685e837 Wang Jianchao 2021-07-24  6236  		start = 
mb_find_next_zero_bit(bitmap, max + 1, start);
55a3430685e837 Wang Jianchao 2021-07-24  6237  		if (start > max)
55a3430685e837 Wang Jianchao 2021-07-24  6238  			break;
55a3430685e837 Wang Jianchao 2021-07-24  6239  		next = 
mb_find_next_bit(bitmap, max + 1, start);
55a3430685e837 Wang Jianchao 2021-07-24  6240  55a3430685e837 Wang 
Jianchao 2021-07-24  6241  		if ((next - start) >= minblocks) {
55a3430685e837 Wang Jianchao 2021-07-24  6242  			ret = 
ext4_trim_extent(sb, start, next - start, e4b);
55a3430685e837 Wang Jianchao 2021-07-24  6243  			if (ret && ret != 
-EOPNOTSUPP)
55a3430685e837 Wang Jianchao 2021-07-24  6244  				break;
55a3430685e837 Wang Jianchao 2021-07-24 @6245  			ret = 0;
55a3430685e837 Wang Jianchao 2021-07-24  6246  			count += next - start;
55a3430685e837 Wang Jianchao 2021-07-24  6247  		}
55a3430685e837 Wang Jianchao 2021-07-24  6248  		free_count += next - start;
55a3430685e837 Wang Jianchao 2021-07-24  6249  		start = next + 1;
55a3430685e837 Wang Jianchao 2021-07-24  6250  55a3430685e837 Wang 
Jianchao 2021-07-24  6251  		if (fatal_signal_pending(current)) {
55a3430685e837 Wang Jianchao 2021-07-24  6252  			count = -ERESTARTSYS;
55a3430685e837 Wang Jianchao 2021-07-24  6253  			break;
55a3430685e837 Wang Jianchao 2021-07-24  6254  		}
55a3430685e837 Wang Jianchao 2021-07-24  6255  55a3430685e837 Wang 
Jianchao 2021-07-24  6256  		if (need_resched()) {
55a3430685e837 Wang Jianchao 2021-07-24  6257  			ext4_unlock_group(sb, 
e4b->bd_group);
55a3430685e837 Wang Jianchao 2021-07-24  6258  			cond_resched();
55a3430685e837 Wang Jianchao 2021-07-24  6259  			ext4_lock_group(sb, 
e4b->bd_group);
55a3430685e837 Wang Jianchao 2021-07-24  6260  		}
55a3430685e837 Wang Jianchao 2021-07-24  6261  55a3430685e837 Wang 
Jianchao 2021-07-24  6262  		if ((e4b->bd_info->bb_free - free_count) < 
minblocks)
55a3430685e837 Wang Jianchao 2021-07-24  6263  			break;
55a3430685e837 Wang Jianchao 2021-07-24  6264  	}
55a3430685e837 Wang Jianchao 2021-07-24  6265  55a3430685e837 Wang 
Jianchao 2021-07-24  6266  	return count;
55a3430685e837 Wang Jianchao 2021-07-24  6267  }
55a3430685e837 Wang Jianchao 2021-07-24  6268
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


Download attachment ".config.gz" of type "application/gzip" (29411 bytes)

View attachment "Attached Message Part" of type "text/plain" (151 bytes)

Powered by blists - more mailing lists