All of lore.kernel.org
 help / color / mirror / Atom feed
* [djwong-xfs:refactor-log-recovery 222/314] fs/xfs/scrub/agheader.c:791:14: warning: Variable 'error' is assigned a value that is never used. [unreadVariable]
@ 2020-04-13  2:24 kbuild test robot
  2020-04-15  9:08 ` Rong Chen
  0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2020-04-13  2:24 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git refactor-log-recovery
head:   2dcdc305cfc2b8b1beee483cf8ae5c674d9fac86
commit: a1d7e2349acff361b779a5e4bbd3c7c77d01d205 [222/314] xfs: store inode btree block counts in AGI header

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


cppcheck warnings: (new ones prefixed by >>)

   fs/xfs/xfs_attr_inactive.c:42:8: warning: The scope of the variable 'error' can be reduced. [variableScope]
    int   error;
          ^
   fs/xfs/xfs_attr_inactive.c:138:25: warning: The scope of the variable 'info' can be reduced. [variableScope]
    struct xfs_da_blkinfo *info;
                           ^
   fs/xfs/xfs_attr_inactive.c:143:8: warning: The scope of the variable 'error' can be reduced. [variableScope]
    int   error, i;
          ^
   fs/xfs/xfs_attr_inactive.c:57:7: warning: Label '__here' is not used. [unusedLabel]
     if (XFS_IS_CORRUPT(dp->i_mount, nmap != 1))
         ^
   fs/xfs/xfs_attr_inactive.c:149:3: warning: Label '__here' is not used. [unusedLabel]
     xfs_buf_mark_corrupt(bp);
     ^
   fs/xfs/xfs_attr_inactive.c:199:4: warning: Label '__here' is not used. [unusedLabel]
      xfs_buf_mark_corrupt(child_bp);
      ^
   fs/xfs/xfs_attr_inactive.c:296:3: warning: Label '__here' is not used. [unusedLabel]
     xfs_buf_mark_corrupt(bp);
     ^
   fs/xfs/xfs_buf.h:278:38: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
    bool wait = bp->b_flags & XBF_ASYNC ? false : true;
                                        ^
>> fs/xfs/xfs_attr_inactive.c:149:3: warning: Variable '__here' is not assigned a value. [unassignedVariable]
     xfs_buf_mark_corrupt(bp);
     ^
   fs/xfs/xfs_attr_inactive.c:199:4: warning: Variable '__here' is not assigned a value. [unassignedVariable]
      xfs_buf_mark_corrupt(child_bp);
      ^
   fs/xfs/xfs_attr_inactive.c:296:3: warning: Variable '__here' is not assigned a value. [unassignedVariable]
     xfs_buf_mark_corrupt(bp);
     ^
   nofile:0:0: warning: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]
   
--
   fs/xfs/xfs_attr_list.c:294:26: warning: The scope of the variable 'node' can be reduced. [variableScope]
    struct xfs_da_intnode  *node;
                            ^
   fs/xfs/xfs_attr_list.c:85:8: warning: Label '__here' is not used. [unusedLabel]
      if (XFS_IS_CORRUPT(context->dp->i_mount,
          ^
   fs/xfs/xfs_attr_list.c:178:7: warning: Label '__here' is not used. [unusedLabel]
     if (XFS_IS_CORRUPT(context->dp->i_mount,
         ^
   fs/xfs/xfs_attr_list.c:268:7: warning: Label '__here' is not used. [unusedLabel]
     if (XFS_IS_CORRUPT(mp, cursor->blkno == 0)) {
         ^
   fs/xfs/xfs_attr_list.c:281:2: warning: Label '__here' is not used. [unusedLabel]
    xfs_buf_mark_corrupt(bp);
    ^
   fs/xfs/xfs_attr_list.c:472:7: warning: Label '__here' is not used. [unusedLabel]
     if (XFS_IS_CORRUPT(context->dp->i_mount,
         ^
   fs/xfs/xfs_buf.h:278:38: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
    bool wait = bp->b_flags & XBF_ASYNC ? false : true;
                                        ^
>> fs/xfs/xfs_attr_list.c:281:2: warning: Variable '__here' is not assigned a value. [unassignedVariable]
    xfs_buf_mark_corrupt(bp);
    ^
   fs/xfs/xfs_attr_list.c:67:7: warning: Either the condition 'sf!=NULL' is redundant or there is possible null pointer dereference: sf. [nullPointerRedundantCheck]
    if (!sf->hdr.count)
         ^
   fs/xfs/xfs_attr_list.c:66:2: note: Assuming that condition 'sf!=NULL' is not redundant
    ASSERT(sf != NULL);
    ^
   fs/xfs/xfs_attr_list.c:65:7: note: Assignment 'sf=(xfs_attr_shortform_t*)dp->i_afp->if_u1.if_data', assigned value is 0
    sf = (xfs_attr_shortform_t *)dp->i_afp->if_u1.if_data;
         ^
   fs/xfs/xfs_attr_list.c:67:7: note: Null pointer dereference
    if (!sf->hdr.count)
         ^
   nofile:0:0: warning: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]
   
--
   fs/xfs/xfs_inode.c:1403:6: warning: Condition 'error' is always false [knownConditionTrueFalse]
    if (error)
        ^
   fs/xfs/xfs_inode.c:1402:10: note: Assignment 'error=0', assigned value is 0
    error = xfs_qm_dqattach(sip);
            ^
   fs/xfs/xfs_inode.c:1403:6: note: Condition 'error' is always false
    if (error)
        ^
   fs/xfs/xfs_inode.c:1407:6: warning: Condition 'error' is always false [knownConditionTrueFalse]
    if (error)
        ^
   fs/xfs/xfs_inode.c:1406:10: note: Assignment 'error=0', assigned value is 0
    error = xfs_qm_dqattach(tdp);
            ^
   fs/xfs/xfs_inode.c:1407:6: note: Condition 'error' is always false
    if (error)
        ^
>> fs/xfs/xfs_inode.c:1862:6: warning: Condition 'ret' is always false [knownConditionTrueFalse]
    if (ret)
        ^
   fs/xfs/xfs_inode.c:1861:8: note: Assignment 'ret=0', assigned value is 0
    ret = xfs_qm_dqattach(ip);
          ^
   fs/xfs/xfs_inode.c:1862:6: note: Condition 'ret' is always false
    if (ret)
        ^
   fs/xfs/xfs_inode.c:1896:6: warning: Condition 'ret' is always false [knownConditionTrueFalse]
    if (ret)
        ^
   fs/xfs/xfs_inode.c:1895:8: note: Assignment 'ret=0', assigned value is 0
    ret = xfs_qm_dqattach(ip);
          ^
   fs/xfs/xfs_inode.c:1896:6: note: Condition 'ret' is always false
    if (ret)
        ^
   fs/xfs/xfs_inode.c:2036:6: warning: Condition 'error' is always false [knownConditionTrueFalse]
    if (error)
        ^
   fs/xfs/xfs_inode.c:2035:10: note: Assignment 'error=0', assigned value is 0
    error = xfs_qm_dqattach(ip);
            ^
   fs/xfs/xfs_inode.c:2036:6: note: Condition 'error' is always false
    if (error)
        ^
   fs/xfs/xfs_inode.c:3107:6: warning: Condition 'error' is always false [knownConditionTrueFalse]
    if (error)
        ^
   fs/xfs/xfs_inode.c:3106:10: note: Assignment 'error=0', assigned value is 0
    error = xfs_qm_dqattach(dp);
            ^
   fs/xfs/xfs_inode.c:3107:6: note: Condition 'error' is always false
    if (error)
        ^
   fs/xfs/xfs_inode.c:3111:6: warning: Condition 'error' is always false [knownConditionTrueFalse]
    if (error)
        ^
   fs/xfs/xfs_inode.c:3110:10: note: Assignment 'error=0', assigned value is 0
    error = xfs_qm_dqattach(ip);
            ^
   fs/xfs/xfs_inode.c:3111:6: note: Condition 'error' is always false
    if (error)
        ^
   fs/xfs/xfs_inode.c:3475:6: warning: Condition 'error' is always false [knownConditionTrueFalse]
    if (error)
        ^
   fs/xfs/xfs_inode.c:3474:10: note: Assignment 'error=0', assigned value is 0
    error = xfs_qm_vop_rename_dqattach(inodes);
            ^
   fs/xfs/xfs_inode.c:3475:6: note: Condition 'error' is always false
    if (error)
        ^
   fs/xfs/xfs_inode.c:2825:8: warning: The scope of the variable 'ioffset' can be reduced. [variableScope]
    int   ioffset;
          ^
   fs/xfs/xfs_inode.c:2335:3: warning: Label '__here' is not used. [unusedLabel]
     xfs_buf_mark_corrupt(agibp);
     ^
   fs/xfs/xfs_inode.c:2402:19: warning: Label '__here' is not used. [unusedLabel]
       sizeof(*dip), __this_address);
                     ^
   fs/xfs/xfs_inode.c:2417:25: warning: Label '__here' is not used. [unusedLabel]
        dip, sizeof(*dip), __this_address);
                           ^
   fs/xfs/xfs_inode.c:2472:3: warning: Label '__here' is not used. [unusedLabel]
     xfs_buf_mark_corrupt(agibp);
     ^
   fs/xfs/xfs_inode.c:3859:2: warning: Label '__here' is not used. [unusedLabel]
    xfs_buf_ioerror(bp, -EIO);
    ^
   fs/xfs/xfs_buf.h:278:38: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
    bool wait = bp->b_flags & XBF_ASYNC ? false : true;
                                        ^
   fs/xfs/xfs_inode.c:2335:3: warning: Variable '__here' is not assigned a value. [unassignedVariable]
     xfs_buf_mark_corrupt(agibp);
     ^
   fs/xfs/xfs_inode.c:2402:19: warning: Variable '__here' is not assigned a value. [unassignedVariable]
       sizeof(*dip), __this_address);
                     ^
   fs/xfs/xfs_inode.c:2417:25: warning: Variable '__here' is not assigned a value. [unassignedVariable]
        dip, sizeof(*dip), __this_address);
                           ^
   fs/xfs/xfs_inode.c:2472:3: warning: Variable '__here' is not assigned a value. [unassignedVariable]
     xfs_buf_mark_corrupt(agibp);
     ^
   fs/xfs/xfs_inode.c:3859:2: warning: Variable '__here' is not assigned a value. [unassignedVariable]
    xfs_buf_ioerror(bp, -EIO);
    ^
   fs/xfs/xfs_inode.c:4102:29: warning: Either the condition 'iip!=NULL' is redundant or there is possible null pointer dereference: iip. [nullPointerRedundantCheck]
    xfs_inode_to_disk(ip, dip, iip->ili_item.li_lsn);
                               ^
   fs/xfs/xfs_inode.c:4029:2: note: Assuming that condition 'iip!=NULL' is not redundant
    ASSERT(iip != NULL && iip->ili_fields != 0);
    ^
   fs/xfs/xfs_inode.c:4021:37: note: Assignment 'iip=ip->i_itemp', assigned value is 0
    struct xfs_inode_log_item *iip = ip->i_itemp;
                                       ^
   fs/xfs/xfs_inode.c:4102:29: note: Null pointer dereference
    xfs_inode_to_disk(ip, dip, iip->ili_item.li_lsn);
--
   fs/xfs/xfs_log.c:101:10: warning: The scope of the variable 'new' can be reduced. [variableScope]
    int64_t new, old;
            ^
   fs/xfs/xfs_log.c:127:10: warning: The scope of the variable 'new' can be reduced. [variableScope]
    int64_t new, old;
            ^
   fs/xfs/xfs_log.c:194:8: warning: The scope of the variable 'need_bytes' can be reduced. [variableScope]
    int   need_bytes;
          ^
   fs/xfs/xfs_log.c:1549:11: warning: The scope of the variable 'j' can be reduced. [variableScope]
    int   i, j, k;
             ^
   fs/xfs/xfs_log.c:1549:14: warning: The scope of the variable 'k' can be reduced. [variableScope]
    int   i, j, k;
                ^
   fs/xfs/xfs_log.c:2720:23: warning: The scope of the variable 'first_iclog' can be reduced. [variableScope]
    struct xlog_in_core *first_iclog;
                         ^
   fs/xfs/xfs_buf.h:278:38: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
    bool wait = bp->b_flags & XBF_ASYNC ? false : true;
                                        ^
   fs/xfs/xfs_log_priv.h:474:7: warning: '*ptr' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
    *ptr += bytes;
         ^
>> fs/xfs/xfs_log.c:1647:8: warning: 'data' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
     data += len;
          ^
   fs/xfs/xfs_log.c:1745:44: warning: 'data' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
     uint32_t cycle = get_unaligned_be32(data + i);
                                              ^
   fs/xfs/xfs_log.c:1749:34: warning: 'data' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
     put_unaligned_be32(cycle, data + i);
                                    ^
>> fs/xfs/xfs_log.c:855:8: warning: Variable 'error' is assigned a value that is never used. [unreadVariable]
    error = xlog_state_release_iclog(log, iclog);
          ^
   fs/xfs/xfs_log.c:3552:13: warning: The scope of the variable 'field_offset' can be reduced. [variableScope]
    ptrdiff_t  field_offset;
               ^
>> fs/xfs/xfs_log.c:3456:34: warning: 'log->l_iclog_bak[i]' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
         ptr <= log->l_iclog_bak[i] + log->l_iclog_size)
                                    ^
>> fs/xfs/xfs_log.c:3573:11: warning: 'ptr' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
    for (ptr += BBSIZE; ptr < base_ptr + count; ptr += BBSIZE) {
             ^
>> fs/xfs/xfs_log.c:3573:37: warning: 'base_ptr' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
    for (ptr += BBSIZE; ptr < base_ptr + count; ptr += BBSIZE) {
                                       ^
   fs/xfs/xfs_log.c:3626:7: warning: 'ptr' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
     ptr += sizeof(xlog_op_header_t) + op_len;
         ^
>> fs/xfs/xfs_log.c:3572:4: warning: Variable 'p' is assigned a value that is never used. [unreadVariable]
    p = &iclog->ic_header;
      ^
>> fs/xfs/xfs_log.c:3582:9: warning: Variable 'ophead' is assigned a value that is never used. [unreadVariable]
    ophead = ptr;
           ^
   nofile:0:0: warning: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]
   
--
   fs/xfs/scrub/agheader.c:66:12: warning: The scope of the variable 'v2_ok' can be reduced. [variableScope]
    uint32_t  v2_ok;
              ^
>> fs/xfs/scrub/agheader.c:791:14: warning: Variable 'error' is assigned a value that is never used. [unreadVariable]
    int   error = 0;
                ^
--
>> fs/xfs/scrub/health.c:134:23: warning: The expression 'error == 0' is always true. [knownConditionTrueFalse]
    for (agno = 0; error == 0 && agno < mp->m_sb.sb_agcount; agno++) {
                         ^
   fs/xfs/scrub/health.c:130:16: note: 'error' is assigned value '0' here.
    int   error = 0;
                  ^
   fs/xfs/scrub/health.c:134:23: note: The expression 'error == 0' is always true.
    for (agno = 0; error == 0 && agno < mp->m_sb.sb_agcount; agno++) {
                         ^
   fs/xfs/scrub/health.c:128:20: warning: The scope of the variable 'pag' can be reduced. [variableScope]
    struct xfs_perag *pag;
                      ^
   fs/xfs/scrub/health.c:303:20: warning: The scope of the variable 'pag' can be reduced. [variableScope]
    struct xfs_perag *pag;
                      ^
--
   fs/xfs/scrub/bmap_repair.c:207:8: warning: The scope of the variable 'error' can be reduced. [variableScope]
    int   error = 0;
          ^
   fs/xfs/scrub/bmap_repair.c:303:8: warning: The scope of the variable 'error' can be reduced. [variableScope]
    int   error;
          ^
>> fs/xfs/scrub/bmap_repair.c:207:14: warning: Variable 'error' is assigned a value that is never used. [unreadVariable]
    int   error = 0;
                ^
--
>> fs/xfs/scrub/ialloc_repair.c:224:14: warning: Variable 'error' is assigned a value that is never used. [unreadVariable]
    int   error = 0;
                ^
--
>> fs/xfs/scrub/rmap_repair.c:199:16: warning: Argument 'error==0' to function ASSERT is always 0 [constArgument]
     ASSERT(error == 0);
                  ^
   fs/xfs/scrub/rmap_repair.c:198:6: note: Assuming that condition 'error' is not redundant
    if (error)
        ^
   fs/xfs/scrub/rmap_repair.c:199:16: note: Argument 'error==0' to function ASSERT is always 0
     ASSERT(error == 0);
                  ^
   fs/xfs/scrub/rmap_repair.c:203:16: warning: Argument 'error==0' to function ASSERT is always 0 [constArgument]
     ASSERT(error == 0);
                  ^
   fs/xfs/scrub/rmap_repair.c:202:6: note: Assuming that condition 'error' is not redundant
    if (error)
        ^
   fs/xfs/scrub/rmap_repair.c:203:16: note: Argument 'error==0' to function ASSERT is always 0
     ASSERT(error == 0);
                  ^
--
>> fs/xfs/scrub/symlink_repair.c:210:8: warning: Variable 'error' is reassigned a value before the old one has been used. [redundantAssignment]
    error = xfs_symlink_write_target(sc->tp, sc->ip, sc->buf, target_len,
          ^
   fs/xfs/scrub/symlink_repair.c:206:8: note: error is assigned
    error = xfs_trans_reserve_quota_nblks(sc->tp, sc->ip, resblks, 0,
          ^
   fs/xfs/scrub/symlink_repair.c:210:8: note: error is overwritten
    error = xfs_symlink_write_target(sc->tp, sc->ip, sc->buf, target_len,
          ^
   fs/xfs/scrub/symlink_repair.c:56:16: warning: The scope of the variable 'byte_cnt' can be reduced. [variableScope]
    unsigned int  byte_cnt;
                  ^
   fs/xfs/scrub/symlink_repair.c:57:9: warning: The scope of the variable 'magic_ok' can be reduced. [variableScope]
    bool   magic_ok;
           ^
   fs/xfs/scrub/symlink_repair.c:58:9: warning: The scope of the variable 'hdr_ok' can be reduced. [variableScope]
    bool   hdr_ok;
           ^

vim +/error +791 fs/xfs/scrub/agheader.c

   783	
   784	/* Check agi_[fi]blocks against tree size */
   785	static inline void
   786	xchk_agi_xref_fiblocks(
   787		struct xfs_scrub	*sc)
   788	{
   789		struct xfs_agi		*agi = sc->sa.agi_bp->b_addr;
   790		xfs_agblock_t		blocks;
 > 791		int			error = 0;
   792	
   793		if (!xfs_sb_version_hasinobtcounts(&sc->mp->m_sb))
   794			return;
   795	
   796		if (sc->sa.ino_cur) {
   797			error = xfs_btree_count_blocks(sc->sa.ino_cur, &blocks);
   798			if (!xchk_should_check_xref(sc, &error, &sc->sa.ino_cur))
   799				return;
   800			if (blocks != be32_to_cpu(agi->agi_iblocks))
   801				xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp);
   802		}
   803	
   804		if (sc->sa.fino_cur) {
   805			error = xfs_btree_count_blocks(sc->sa.fino_cur, &blocks);
   806			if (!xchk_should_check_xref(sc, &error, &sc->sa.fino_cur))
   807				return;
   808			if (blocks != be32_to_cpu(agi->agi_fblocks))
   809				xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp);
   810		}
   811	}
   812	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [djwong-xfs:refactor-log-recovery 222/314] fs/xfs/scrub/agheader.c:791:14: warning: Variable 'error' is assigned a value that is never used. [unreadVariable]
  2020-04-13  2:24 [djwong-xfs:refactor-log-recovery 222/314] fs/xfs/scrub/agheader.c:791:14: warning: Variable 'error' is assigned a value that is never used. [unreadVariable] kbuild test robot
@ 2020-04-15  9:08 ` Rong Chen
  2020-04-20 16:46   ` Darrick J. Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Rong Chen @ 2020-04-15  9:08 UTC (permalink / raw)
  To: kbuild-all

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

Hi Darrick,

Sorry for the false warning, we have blacklisted them, please ignore 
recent cppcheck reports.

Best Regards,
Rong Chen

On 4/13/20 10:24 AM, kbuild test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git refactor-log-recovery
> head:   2dcdc305cfc2b8b1beee483cf8ae5c674d9fac86
> commit: a1d7e2349acff361b779a5e4bbd3c7c77d01d205 [222/314] xfs: store inode btree block counts in AGI header
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kbuild test robot <lkp@intel.com>
>
>
> cppcheck warnings: (new ones prefixed by >>)
>
>     fs/xfs/xfs_attr_inactive.c:42:8: warning: The scope of the variable 'error' can be reduced. [variableScope]
>      int   error;
>            ^
>     fs/xfs/xfs_attr_inactive.c:138:25: warning: The scope of the variable 'info' can be reduced. [variableScope]
>      struct xfs_da_blkinfo *info;
>                             ^
>     fs/xfs/xfs_attr_inactive.c:143:8: warning: The scope of the variable 'error' can be reduced. [variableScope]
>      int   error, i;
>            ^
>     fs/xfs/xfs_attr_inactive.c:57:7: warning: Label '__here' is not used. [unusedLabel]
>       if (XFS_IS_CORRUPT(dp->i_mount, nmap != 1))
>           ^
>     fs/xfs/xfs_attr_inactive.c:149:3: warning: Label '__here' is not used. [unusedLabel]
>       xfs_buf_mark_corrupt(bp);
>       ^
>     fs/xfs/xfs_attr_inactive.c:199:4: warning: Label '__here' is not used. [unusedLabel]
>        xfs_buf_mark_corrupt(child_bp);
>        ^
>     fs/xfs/xfs_attr_inactive.c:296:3: warning: Label '__here' is not used. [unusedLabel]
>       xfs_buf_mark_corrupt(bp);
>       ^
>     fs/xfs/xfs_buf.h:278:38: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
>      bool wait = bp->b_flags & XBF_ASYNC ? false : true;
>                                          ^
>>> fs/xfs/xfs_attr_inactive.c:149:3: warning: Variable '__here' is not assigned a value. [unassignedVariable]
>       xfs_buf_mark_corrupt(bp);
>       ^
>     fs/xfs/xfs_attr_inactive.c:199:4: warning: Variable '__here' is not assigned a value. [unassignedVariable]
>        xfs_buf_mark_corrupt(child_bp);
>        ^
>     fs/xfs/xfs_attr_inactive.c:296:3: warning: Variable '__here' is not assigned a value. [unassignedVariable]
>       xfs_buf_mark_corrupt(bp);
>       ^
>     nofile:0:0: warning: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]
>     
> --
>     fs/xfs/xfs_attr_list.c:294:26: warning: The scope of the variable 'node' can be reduced. [variableScope]
>      struct xfs_da_intnode  *node;
>                              ^
>     fs/xfs/xfs_attr_list.c:85:8: warning: Label '__here' is not used. [unusedLabel]
>        if (XFS_IS_CORRUPT(context->dp->i_mount,
>            ^
>     fs/xfs/xfs_attr_list.c:178:7: warning: Label '__here' is not used. [unusedLabel]
>       if (XFS_IS_CORRUPT(context->dp->i_mount,
>           ^
>     fs/xfs/xfs_attr_list.c:268:7: warning: Label '__here' is not used. [unusedLabel]
>       if (XFS_IS_CORRUPT(mp, cursor->blkno == 0)) {
>           ^
>     fs/xfs/xfs_attr_list.c:281:2: warning: Label '__here' is not used. [unusedLabel]
>      xfs_buf_mark_corrupt(bp);
>      ^
>     fs/xfs/xfs_attr_list.c:472:7: warning: Label '__here' is not used. [unusedLabel]
>       if (XFS_IS_CORRUPT(context->dp->i_mount,
>           ^
>     fs/xfs/xfs_buf.h:278:38: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
>      bool wait = bp->b_flags & XBF_ASYNC ? false : true;
>                                          ^
>>> fs/xfs/xfs_attr_list.c:281:2: warning: Variable '__here' is not assigned a value. [unassignedVariable]
>      xfs_buf_mark_corrupt(bp);
>      ^
>     fs/xfs/xfs_attr_list.c:67:7: warning: Either the condition 'sf!=NULL' is redundant or there is possible null pointer dereference: sf. [nullPointerRedundantCheck]
>      if (!sf->hdr.count)
>           ^
>     fs/xfs/xfs_attr_list.c:66:2: note: Assuming that condition 'sf!=NULL' is not redundant
>      ASSERT(sf != NULL);
>      ^
>     fs/xfs/xfs_attr_list.c:65:7: note: Assignment 'sf=(xfs_attr_shortform_t*)dp->i_afp->if_u1.if_data', assigned value is 0
>      sf = (xfs_attr_shortform_t *)dp->i_afp->if_u1.if_data;
>           ^
>     fs/xfs/xfs_attr_list.c:67:7: note: Null pointer dereference
>      if (!sf->hdr.count)
>           ^
>     nofile:0:0: warning: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]
>     
> --
>     fs/xfs/xfs_inode.c:1403:6: warning: Condition 'error' is always false [knownConditionTrueFalse]
>      if (error)
>          ^
>     fs/xfs/xfs_inode.c:1402:10: note: Assignment 'error=0', assigned value is 0
>      error = xfs_qm_dqattach(sip);
>              ^
>     fs/xfs/xfs_inode.c:1403:6: note: Condition 'error' is always false
>      if (error)
>          ^
>     fs/xfs/xfs_inode.c:1407:6: warning: Condition 'error' is always false [knownConditionTrueFalse]
>      if (error)
>          ^
>     fs/xfs/xfs_inode.c:1406:10: note: Assignment 'error=0', assigned value is 0
>      error = xfs_qm_dqattach(tdp);
>              ^
>     fs/xfs/xfs_inode.c:1407:6: note: Condition 'error' is always false
>      if (error)
>          ^
>>> fs/xfs/xfs_inode.c:1862:6: warning: Condition 'ret' is always false [knownConditionTrueFalse]
>      if (ret)
>          ^
>     fs/xfs/xfs_inode.c:1861:8: note: Assignment 'ret=0', assigned value is 0
>      ret = xfs_qm_dqattach(ip);
>            ^
>     fs/xfs/xfs_inode.c:1862:6: note: Condition 'ret' is always false
>      if (ret)
>          ^
>     fs/xfs/xfs_inode.c:1896:6: warning: Condition 'ret' is always false [knownConditionTrueFalse]
>      if (ret)
>          ^
>     fs/xfs/xfs_inode.c:1895:8: note: Assignment 'ret=0', assigned value is 0
>      ret = xfs_qm_dqattach(ip);
>            ^
>     fs/xfs/xfs_inode.c:1896:6: note: Condition 'ret' is always false
>      if (ret)
>          ^
>     fs/xfs/xfs_inode.c:2036:6: warning: Condition 'error' is always false [knownConditionTrueFalse]
>      if (error)
>          ^
>     fs/xfs/xfs_inode.c:2035:10: note: Assignment 'error=0', assigned value is 0
>      error = xfs_qm_dqattach(ip);
>              ^
>     fs/xfs/xfs_inode.c:2036:6: note: Condition 'error' is always false
>      if (error)
>          ^
>     fs/xfs/xfs_inode.c:3107:6: warning: Condition 'error' is always false [knownConditionTrueFalse]
>      if (error)
>          ^
>     fs/xfs/xfs_inode.c:3106:10: note: Assignment 'error=0', assigned value is 0
>      error = xfs_qm_dqattach(dp);
>              ^
>     fs/xfs/xfs_inode.c:3107:6: note: Condition 'error' is always false
>      if (error)
>          ^
>     fs/xfs/xfs_inode.c:3111:6: warning: Condition 'error' is always false [knownConditionTrueFalse]
>      if (error)
>          ^
>     fs/xfs/xfs_inode.c:3110:10: note: Assignment 'error=0', assigned value is 0
>      error = xfs_qm_dqattach(ip);
>              ^
>     fs/xfs/xfs_inode.c:3111:6: note: Condition 'error' is always false
>      if (error)
>          ^
>     fs/xfs/xfs_inode.c:3475:6: warning: Condition 'error' is always false [knownConditionTrueFalse]
>      if (error)
>          ^
>     fs/xfs/xfs_inode.c:3474:10: note: Assignment 'error=0', assigned value is 0
>      error = xfs_qm_vop_rename_dqattach(inodes);
>              ^
>     fs/xfs/xfs_inode.c:3475:6: note: Condition 'error' is always false
>      if (error)
>          ^
>     fs/xfs/xfs_inode.c:2825:8: warning: The scope of the variable 'ioffset' can be reduced. [variableScope]
>      int   ioffset;
>            ^
>     fs/xfs/xfs_inode.c:2335:3: warning: Label '__here' is not used. [unusedLabel]
>       xfs_buf_mark_corrupt(agibp);
>       ^
>     fs/xfs/xfs_inode.c:2402:19: warning: Label '__here' is not used. [unusedLabel]
>         sizeof(*dip), __this_address);
>                       ^
>     fs/xfs/xfs_inode.c:2417:25: warning: Label '__here' is not used. [unusedLabel]
>          dip, sizeof(*dip), __this_address);
>                             ^
>     fs/xfs/xfs_inode.c:2472:3: warning: Label '__here' is not used. [unusedLabel]
>       xfs_buf_mark_corrupt(agibp);
>       ^
>     fs/xfs/xfs_inode.c:3859:2: warning: Label '__here' is not used. [unusedLabel]
>      xfs_buf_ioerror(bp, -EIO);
>      ^
>     fs/xfs/xfs_buf.h:278:38: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
>      bool wait = bp->b_flags & XBF_ASYNC ? false : true;
>                                          ^
>     fs/xfs/xfs_inode.c:2335:3: warning: Variable '__here' is not assigned a value. [unassignedVariable]
>       xfs_buf_mark_corrupt(agibp);
>       ^
>     fs/xfs/xfs_inode.c:2402:19: warning: Variable '__here' is not assigned a value. [unassignedVariable]
>         sizeof(*dip), __this_address);
>                       ^
>     fs/xfs/xfs_inode.c:2417:25: warning: Variable '__here' is not assigned a value. [unassignedVariable]
>          dip, sizeof(*dip), __this_address);
>                             ^
>     fs/xfs/xfs_inode.c:2472:3: warning: Variable '__here' is not assigned a value. [unassignedVariable]
>       xfs_buf_mark_corrupt(agibp);
>       ^
>     fs/xfs/xfs_inode.c:3859:2: warning: Variable '__here' is not assigned a value. [unassignedVariable]
>      xfs_buf_ioerror(bp, -EIO);
>      ^
>     fs/xfs/xfs_inode.c:4102:29: warning: Either the condition 'iip!=NULL' is redundant or there is possible null pointer dereference: iip. [nullPointerRedundantCheck]
>      xfs_inode_to_disk(ip, dip, iip->ili_item.li_lsn);
>                                 ^
>     fs/xfs/xfs_inode.c:4029:2: note: Assuming that condition 'iip!=NULL' is not redundant
>      ASSERT(iip != NULL && iip->ili_fields != 0);
>      ^
>     fs/xfs/xfs_inode.c:4021:37: note: Assignment 'iip=ip->i_itemp', assigned value is 0
>      struct xfs_inode_log_item *iip = ip->i_itemp;
>                                         ^
>     fs/xfs/xfs_inode.c:4102:29: note: Null pointer dereference
>      xfs_inode_to_disk(ip, dip, iip->ili_item.li_lsn);
> --
>     fs/xfs/xfs_log.c:101:10: warning: The scope of the variable 'new' can be reduced. [variableScope]
>      int64_t new, old;
>              ^
>     fs/xfs/xfs_log.c:127:10: warning: The scope of the variable 'new' can be reduced. [variableScope]
>      int64_t new, old;
>              ^
>     fs/xfs/xfs_log.c:194:8: warning: The scope of the variable 'need_bytes' can be reduced. [variableScope]
>      int   need_bytes;
>            ^
>     fs/xfs/xfs_log.c:1549:11: warning: The scope of the variable 'j' can be reduced. [variableScope]
>      int   i, j, k;
>               ^
>     fs/xfs/xfs_log.c:1549:14: warning: The scope of the variable 'k' can be reduced. [variableScope]
>      int   i, j, k;
>                  ^
>     fs/xfs/xfs_log.c:2720:23: warning: The scope of the variable 'first_iclog' can be reduced. [variableScope]
>      struct xlog_in_core *first_iclog;
>                           ^
>     fs/xfs/xfs_buf.h:278:38: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
>      bool wait = bp->b_flags & XBF_ASYNC ? false : true;
>                                          ^
>     fs/xfs/xfs_log_priv.h:474:7: warning: '*ptr' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
>      *ptr += bytes;
>           ^
>>> fs/xfs/xfs_log.c:1647:8: warning: 'data' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
>       data += len;
>            ^
>     fs/xfs/xfs_log.c:1745:44: warning: 'data' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
>       uint32_t cycle = get_unaligned_be32(data + i);
>                                                ^
>     fs/xfs/xfs_log.c:1749:34: warning: 'data' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
>       put_unaligned_be32(cycle, data + i);
>                                      ^
>>> fs/xfs/xfs_log.c:855:8: warning: Variable 'error' is assigned a value that is never used. [unreadVariable]
>      error = xlog_state_release_iclog(log, iclog);
>            ^
>     fs/xfs/xfs_log.c:3552:13: warning: The scope of the variable 'field_offset' can be reduced. [variableScope]
>      ptrdiff_t  field_offset;
>                 ^
>>> fs/xfs/xfs_log.c:3456:34: warning: 'log->l_iclog_bak[i]' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
>           ptr <= log->l_iclog_bak[i] + log->l_iclog_size)
>                                      ^
>>> fs/xfs/xfs_log.c:3573:11: warning: 'ptr' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
>      for (ptr += BBSIZE; ptr < base_ptr + count; ptr += BBSIZE) {
>               ^
>>> fs/xfs/xfs_log.c:3573:37: warning: 'base_ptr' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
>      for (ptr += BBSIZE; ptr < base_ptr + count; ptr += BBSIZE) {
>                                         ^
>     fs/xfs/xfs_log.c:3626:7: warning: 'ptr' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
>       ptr += sizeof(xlog_op_header_t) + op_len;
>           ^
>>> fs/xfs/xfs_log.c:3572:4: warning: Variable 'p' is assigned a value that is never used. [unreadVariable]
>      p = &iclog->ic_header;
>        ^
>>> fs/xfs/xfs_log.c:3582:9: warning: Variable 'ophead' is assigned a value that is never used. [unreadVariable]
>      ophead = ptr;
>             ^
>     nofile:0:0: warning: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]
>     
> --
>     fs/xfs/scrub/agheader.c:66:12: warning: The scope of the variable 'v2_ok' can be reduced. [variableScope]
>      uint32_t  v2_ok;
>                ^
>>> fs/xfs/scrub/agheader.c:791:14: warning: Variable 'error' is assigned a value that is never used. [unreadVariable]
>      int   error = 0;
>                  ^
> --
>>> fs/xfs/scrub/health.c:134:23: warning: The expression 'error == 0' is always true. [knownConditionTrueFalse]
>      for (agno = 0; error == 0 && agno < mp->m_sb.sb_agcount; agno++) {
>                           ^
>     fs/xfs/scrub/health.c:130:16: note: 'error' is assigned value '0' here.
>      int   error = 0;
>                    ^
>     fs/xfs/scrub/health.c:134:23: note: The expression 'error == 0' is always true.
>      for (agno = 0; error == 0 && agno < mp->m_sb.sb_agcount; agno++) {
>                           ^
>     fs/xfs/scrub/health.c:128:20: warning: The scope of the variable 'pag' can be reduced. [variableScope]
>      struct xfs_perag *pag;
>                        ^
>     fs/xfs/scrub/health.c:303:20: warning: The scope of the variable 'pag' can be reduced. [variableScope]
>      struct xfs_perag *pag;
>                        ^
> --
>     fs/xfs/scrub/bmap_repair.c:207:8: warning: The scope of the variable 'error' can be reduced. [variableScope]
>      int   error = 0;
>            ^
>     fs/xfs/scrub/bmap_repair.c:303:8: warning: The scope of the variable 'error' can be reduced. [variableScope]
>      int   error;
>            ^
>>> fs/xfs/scrub/bmap_repair.c:207:14: warning: Variable 'error' is assigned a value that is never used. [unreadVariable]
>      int   error = 0;
>                  ^
> --
>>> fs/xfs/scrub/ialloc_repair.c:224:14: warning: Variable 'error' is assigned a value that is never used. [unreadVariable]
>      int   error = 0;
>                  ^
> --
>>> fs/xfs/scrub/rmap_repair.c:199:16: warning: Argument 'error==0' to function ASSERT is always 0 [constArgument]
>       ASSERT(error == 0);
>                    ^
>     fs/xfs/scrub/rmap_repair.c:198:6: note: Assuming that condition 'error' is not redundant
>      if (error)
>          ^
>     fs/xfs/scrub/rmap_repair.c:199:16: note: Argument 'error==0' to function ASSERT is always 0
>       ASSERT(error == 0);
>                    ^
>     fs/xfs/scrub/rmap_repair.c:203:16: warning: Argument 'error==0' to function ASSERT is always 0 [constArgument]
>       ASSERT(error == 0);
>                    ^
>     fs/xfs/scrub/rmap_repair.c:202:6: note: Assuming that condition 'error' is not redundant
>      if (error)
>          ^
>     fs/xfs/scrub/rmap_repair.c:203:16: note: Argument 'error==0' to function ASSERT is always 0
>       ASSERT(error == 0);
>                    ^
> --
>>> fs/xfs/scrub/symlink_repair.c:210:8: warning: Variable 'error' is reassigned a value before the old one has been used. [redundantAssignment]
>      error = xfs_symlink_write_target(sc->tp, sc->ip, sc->buf, target_len,
>            ^
>     fs/xfs/scrub/symlink_repair.c:206:8: note: error is assigned
>      error = xfs_trans_reserve_quota_nblks(sc->tp, sc->ip, resblks, 0,
>            ^
>     fs/xfs/scrub/symlink_repair.c:210:8: note: error is overwritten
>      error = xfs_symlink_write_target(sc->tp, sc->ip, sc->buf, target_len,
>            ^
>     fs/xfs/scrub/symlink_repair.c:56:16: warning: The scope of the variable 'byte_cnt' can be reduced. [variableScope]
>      unsigned int  byte_cnt;
>                    ^
>     fs/xfs/scrub/symlink_repair.c:57:9: warning: The scope of the variable 'magic_ok' can be reduced. [variableScope]
>      bool   magic_ok;
>             ^
>     fs/xfs/scrub/symlink_repair.c:58:9: warning: The scope of the variable 'hdr_ok' can be reduced. [variableScope]
>      bool   hdr_ok;
>             ^
>
> vim +/error +791 fs/xfs/scrub/agheader.c
>
>     783	
>     784	/* Check agi_[fi]blocks against tree size */
>     785	static inline void
>     786	xchk_agi_xref_fiblocks(
>     787		struct xfs_scrub	*sc)
>     788	{
>     789		struct xfs_agi		*agi = sc->sa.agi_bp->b_addr;
>     790		xfs_agblock_t		blocks;
>   > 791		int			error = 0;
>     792	
>     793		if (!xfs_sb_version_hasinobtcounts(&sc->mp->m_sb))
>     794			return;
>     795	
>     796		if (sc->sa.ino_cur) {
>     797			error = xfs_btree_count_blocks(sc->sa.ino_cur, &blocks);
>     798			if (!xchk_should_check_xref(sc, &error, &sc->sa.ino_cur))
>     799				return;
>     800			if (blocks != be32_to_cpu(agi->agi_iblocks))
>     801				xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp);
>     802		}
>     803	
>     804		if (sc->sa.fino_cur) {
>     805			error = xfs_btree_count_blocks(sc->sa.fino_cur, &blocks);
>     806			if (!xchk_should_check_xref(sc, &error, &sc->sa.fino_cur))
>     807				return;
>     808			if (blocks != be32_to_cpu(agi->agi_fblocks))
>     809				xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp);
>     810		}
>     811	}
>     812	
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
> _______________________________________________
> kbuild-all mailing list -- kbuild-all(a)lists.01.org
> To unsubscribe send an email to kbuild-all-leave(a)lists.01.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [djwong-xfs:refactor-log-recovery 222/314] fs/xfs/scrub/agheader.c:791:14: warning: Variable 'error' is assigned a value that is never used. [unreadVariable]
  2020-04-15  9:08 ` Rong Chen
@ 2020-04-20 16:46   ` Darrick J. Wong
  0 siblings, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2020-04-20 16:46 UTC (permalink / raw)
  To: kbuild-all

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

On Wed, Apr 15, 2020 at 05:08:00PM +0800, Rong Chen wrote:
> Hi Darrick,
> 
> Sorry for the false warning, we have blacklisted them, please ignore recent
> cppcheck reports.

Ok, thank you!

--D

> Best Regards,
> Rong Chen
> 
> On 4/13/20 10:24 AM, kbuild test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git refactor-log-recovery
> > head:   2dcdc305cfc2b8b1beee483cf8ae5c674d9fac86
> > commit: a1d7e2349acff361b779a5e4bbd3c7c77d01d205 [222/314] xfs: store inode btree block counts in AGI header
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kbuild test robot <lkp@intel.com>
> > 
> > 
> > cppcheck warnings: (new ones prefixed by >>)
> > 
> >     fs/xfs/xfs_attr_inactive.c:42:8: warning: The scope of the variable 'error' can be reduced. [variableScope]
> >      int   error;
> >            ^
> >     fs/xfs/xfs_attr_inactive.c:138:25: warning: The scope of the variable 'info' can be reduced. [variableScope]
> >      struct xfs_da_blkinfo *info;
> >                             ^
> >     fs/xfs/xfs_attr_inactive.c:143:8: warning: The scope of the variable 'error' can be reduced. [variableScope]
> >      int   error, i;
> >            ^
> >     fs/xfs/xfs_attr_inactive.c:57:7: warning: Label '__here' is not used. [unusedLabel]
> >       if (XFS_IS_CORRUPT(dp->i_mount, nmap != 1))
> >           ^
> >     fs/xfs/xfs_attr_inactive.c:149:3: warning: Label '__here' is not used. [unusedLabel]
> >       xfs_buf_mark_corrupt(bp);
> >       ^
> >     fs/xfs/xfs_attr_inactive.c:199:4: warning: Label '__here' is not used. [unusedLabel]
> >        xfs_buf_mark_corrupt(child_bp);
> >        ^
> >     fs/xfs/xfs_attr_inactive.c:296:3: warning: Label '__here' is not used. [unusedLabel]
> >       xfs_buf_mark_corrupt(bp);
> >       ^
> >     fs/xfs/xfs_buf.h:278:38: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
> >      bool wait = bp->b_flags & XBF_ASYNC ? false : true;
> >                                          ^
> > > > fs/xfs/xfs_attr_inactive.c:149:3: warning: Variable '__here' is not assigned a value. [unassignedVariable]
> >       xfs_buf_mark_corrupt(bp);
> >       ^
> >     fs/xfs/xfs_attr_inactive.c:199:4: warning: Variable '__here' is not assigned a value. [unassignedVariable]
> >        xfs_buf_mark_corrupt(child_bp);
> >        ^
> >     fs/xfs/xfs_attr_inactive.c:296:3: warning: Variable '__here' is not assigned a value. [unassignedVariable]
> >       xfs_buf_mark_corrupt(bp);
> >       ^
> >     nofile:0:0: warning: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]
> > --
> >     fs/xfs/xfs_attr_list.c:294:26: warning: The scope of the variable 'node' can be reduced. [variableScope]
> >      struct xfs_da_intnode  *node;
> >                              ^
> >     fs/xfs/xfs_attr_list.c:85:8: warning: Label '__here' is not used. [unusedLabel]
> >        if (XFS_IS_CORRUPT(context->dp->i_mount,
> >            ^
> >     fs/xfs/xfs_attr_list.c:178:7: warning: Label '__here' is not used. [unusedLabel]
> >       if (XFS_IS_CORRUPT(context->dp->i_mount,
> >           ^
> >     fs/xfs/xfs_attr_list.c:268:7: warning: Label '__here' is not used. [unusedLabel]
> >       if (XFS_IS_CORRUPT(mp, cursor->blkno == 0)) {
> >           ^
> >     fs/xfs/xfs_attr_list.c:281:2: warning: Label '__here' is not used. [unusedLabel]
> >      xfs_buf_mark_corrupt(bp);
> >      ^
> >     fs/xfs/xfs_attr_list.c:472:7: warning: Label '__here' is not used. [unusedLabel]
> >       if (XFS_IS_CORRUPT(context->dp->i_mount,
> >           ^
> >     fs/xfs/xfs_buf.h:278:38: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
> >      bool wait = bp->b_flags & XBF_ASYNC ? false : true;
> >                                          ^
> > > > fs/xfs/xfs_attr_list.c:281:2: warning: Variable '__here' is not assigned a value. [unassignedVariable]
> >      xfs_buf_mark_corrupt(bp);
> >      ^
> >     fs/xfs/xfs_attr_list.c:67:7: warning: Either the condition 'sf!=NULL' is redundant or there is possible null pointer dereference: sf. [nullPointerRedundantCheck]
> >      if (!sf->hdr.count)
> >           ^
> >     fs/xfs/xfs_attr_list.c:66:2: note: Assuming that condition 'sf!=NULL' is not redundant
> >      ASSERT(sf != NULL);
> >      ^
> >     fs/xfs/xfs_attr_list.c:65:7: note: Assignment 'sf=(xfs_attr_shortform_t*)dp->i_afp->if_u1.if_data', assigned value is 0
> >      sf = (xfs_attr_shortform_t *)dp->i_afp->if_u1.if_data;
> >           ^
> >     fs/xfs/xfs_attr_list.c:67:7: note: Null pointer dereference
> >      if (!sf->hdr.count)
> >           ^
> >     nofile:0:0: warning: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]
> > --
> >     fs/xfs/xfs_inode.c:1403:6: warning: Condition 'error' is always false [knownConditionTrueFalse]
> >      if (error)
> >          ^
> >     fs/xfs/xfs_inode.c:1402:10: note: Assignment 'error=0', assigned value is 0
> >      error = xfs_qm_dqattach(sip);
> >              ^
> >     fs/xfs/xfs_inode.c:1403:6: note: Condition 'error' is always false
> >      if (error)
> >          ^
> >     fs/xfs/xfs_inode.c:1407:6: warning: Condition 'error' is always false [knownConditionTrueFalse]
> >      if (error)
> >          ^
> >     fs/xfs/xfs_inode.c:1406:10: note: Assignment 'error=0', assigned value is 0
> >      error = xfs_qm_dqattach(tdp);
> >              ^
> >     fs/xfs/xfs_inode.c:1407:6: note: Condition 'error' is always false
> >      if (error)
> >          ^
> > > > fs/xfs/xfs_inode.c:1862:6: warning: Condition 'ret' is always false [knownConditionTrueFalse]
> >      if (ret)
> >          ^
> >     fs/xfs/xfs_inode.c:1861:8: note: Assignment 'ret=0', assigned value is 0
> >      ret = xfs_qm_dqattach(ip);
> >            ^
> >     fs/xfs/xfs_inode.c:1862:6: note: Condition 'ret' is always false
> >      if (ret)
> >          ^
> >     fs/xfs/xfs_inode.c:1896:6: warning: Condition 'ret' is always false [knownConditionTrueFalse]
> >      if (ret)
> >          ^
> >     fs/xfs/xfs_inode.c:1895:8: note: Assignment 'ret=0', assigned value is 0
> >      ret = xfs_qm_dqattach(ip);
> >            ^
> >     fs/xfs/xfs_inode.c:1896:6: note: Condition 'ret' is always false
> >      if (ret)
> >          ^
> >     fs/xfs/xfs_inode.c:2036:6: warning: Condition 'error' is always false [knownConditionTrueFalse]
> >      if (error)
> >          ^
> >     fs/xfs/xfs_inode.c:2035:10: note: Assignment 'error=0', assigned value is 0
> >      error = xfs_qm_dqattach(ip);
> >              ^
> >     fs/xfs/xfs_inode.c:2036:6: note: Condition 'error' is always false
> >      if (error)
> >          ^
> >     fs/xfs/xfs_inode.c:3107:6: warning: Condition 'error' is always false [knownConditionTrueFalse]
> >      if (error)
> >          ^
> >     fs/xfs/xfs_inode.c:3106:10: note: Assignment 'error=0', assigned value is 0
> >      error = xfs_qm_dqattach(dp);
> >              ^
> >     fs/xfs/xfs_inode.c:3107:6: note: Condition 'error' is always false
> >      if (error)
> >          ^
> >     fs/xfs/xfs_inode.c:3111:6: warning: Condition 'error' is always false [knownConditionTrueFalse]
> >      if (error)
> >          ^
> >     fs/xfs/xfs_inode.c:3110:10: note: Assignment 'error=0', assigned value is 0
> >      error = xfs_qm_dqattach(ip);
> >              ^
> >     fs/xfs/xfs_inode.c:3111:6: note: Condition 'error' is always false
> >      if (error)
> >          ^
> >     fs/xfs/xfs_inode.c:3475:6: warning: Condition 'error' is always false [knownConditionTrueFalse]
> >      if (error)
> >          ^
> >     fs/xfs/xfs_inode.c:3474:10: note: Assignment 'error=0', assigned value is 0
> >      error = xfs_qm_vop_rename_dqattach(inodes);
> >              ^
> >     fs/xfs/xfs_inode.c:3475:6: note: Condition 'error' is always false
> >      if (error)
> >          ^
> >     fs/xfs/xfs_inode.c:2825:8: warning: The scope of the variable 'ioffset' can be reduced. [variableScope]
> >      int   ioffset;
> >            ^
> >     fs/xfs/xfs_inode.c:2335:3: warning: Label '__here' is not used. [unusedLabel]
> >       xfs_buf_mark_corrupt(agibp);
> >       ^
> >     fs/xfs/xfs_inode.c:2402:19: warning: Label '__here' is not used. [unusedLabel]
> >         sizeof(*dip), __this_address);
> >                       ^
> >     fs/xfs/xfs_inode.c:2417:25: warning: Label '__here' is not used. [unusedLabel]
> >          dip, sizeof(*dip), __this_address);
> >                             ^
> >     fs/xfs/xfs_inode.c:2472:3: warning: Label '__here' is not used. [unusedLabel]
> >       xfs_buf_mark_corrupt(agibp);
> >       ^
> >     fs/xfs/xfs_inode.c:3859:2: warning: Label '__here' is not used. [unusedLabel]
> >      xfs_buf_ioerror(bp, -EIO);
> >      ^
> >     fs/xfs/xfs_buf.h:278:38: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
> >      bool wait = bp->b_flags & XBF_ASYNC ? false : true;
> >                                          ^
> >     fs/xfs/xfs_inode.c:2335:3: warning: Variable '__here' is not assigned a value. [unassignedVariable]
> >       xfs_buf_mark_corrupt(agibp);
> >       ^
> >     fs/xfs/xfs_inode.c:2402:19: warning: Variable '__here' is not assigned a value. [unassignedVariable]
> >         sizeof(*dip), __this_address);
> >                       ^
> >     fs/xfs/xfs_inode.c:2417:25: warning: Variable '__here' is not assigned a value. [unassignedVariable]
> >          dip, sizeof(*dip), __this_address);
> >                             ^
> >     fs/xfs/xfs_inode.c:2472:3: warning: Variable '__here' is not assigned a value. [unassignedVariable]
> >       xfs_buf_mark_corrupt(agibp);
> >       ^
> >     fs/xfs/xfs_inode.c:3859:2: warning: Variable '__here' is not assigned a value. [unassignedVariable]
> >      xfs_buf_ioerror(bp, -EIO);
> >      ^
> >     fs/xfs/xfs_inode.c:4102:29: warning: Either the condition 'iip!=NULL' is redundant or there is possible null pointer dereference: iip. [nullPointerRedundantCheck]
> >      xfs_inode_to_disk(ip, dip, iip->ili_item.li_lsn);
> >                                 ^
> >     fs/xfs/xfs_inode.c:4029:2: note: Assuming that condition 'iip!=NULL' is not redundant
> >      ASSERT(iip != NULL && iip->ili_fields != 0);
> >      ^
> >     fs/xfs/xfs_inode.c:4021:37: note: Assignment 'iip=ip->i_itemp', assigned value is 0
> >      struct xfs_inode_log_item *iip = ip->i_itemp;
> >                                         ^
> >     fs/xfs/xfs_inode.c:4102:29: note: Null pointer dereference
> >      xfs_inode_to_disk(ip, dip, iip->ili_item.li_lsn);
> > --
> >     fs/xfs/xfs_log.c:101:10: warning: The scope of the variable 'new' can be reduced. [variableScope]
> >      int64_t new, old;
> >              ^
> >     fs/xfs/xfs_log.c:127:10: warning: The scope of the variable 'new' can be reduced. [variableScope]
> >      int64_t new, old;
> >              ^
> >     fs/xfs/xfs_log.c:194:8: warning: The scope of the variable 'need_bytes' can be reduced. [variableScope]
> >      int   need_bytes;
> >            ^
> >     fs/xfs/xfs_log.c:1549:11: warning: The scope of the variable 'j' can be reduced. [variableScope]
> >      int   i, j, k;
> >               ^
> >     fs/xfs/xfs_log.c:1549:14: warning: The scope of the variable 'k' can be reduced. [variableScope]
> >      int   i, j, k;
> >                  ^
> >     fs/xfs/xfs_log.c:2720:23: warning: The scope of the variable 'first_iclog' can be reduced. [variableScope]
> >      struct xlog_in_core *first_iclog;
> >                           ^
> >     fs/xfs/xfs_buf.h:278:38: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
> >      bool wait = bp->b_flags & XBF_ASYNC ? false : true;
> >                                          ^
> >     fs/xfs/xfs_log_priv.h:474:7: warning: '*ptr' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
> >      *ptr += bytes;
> >           ^
> > > > fs/xfs/xfs_log.c:1647:8: warning: 'data' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
> >       data += len;
> >            ^
> >     fs/xfs/xfs_log.c:1745:44: warning: 'data' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
> >       uint32_t cycle = get_unaligned_be32(data + i);
> >                                                ^
> >     fs/xfs/xfs_log.c:1749:34: warning: 'data' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
> >       put_unaligned_be32(cycle, data + i);
> >                                      ^
> > > > fs/xfs/xfs_log.c:855:8: warning: Variable 'error' is assigned a value that is never used. [unreadVariable]
> >      error = xlog_state_release_iclog(log, iclog);
> >            ^
> >     fs/xfs/xfs_log.c:3552:13: warning: The scope of the variable 'field_offset' can be reduced. [variableScope]
> >      ptrdiff_t  field_offset;
> >                 ^
> > > > fs/xfs/xfs_log.c:3456:34: warning: 'log->l_iclog_bak[i]' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
> >           ptr <= log->l_iclog_bak[i] + log->l_iclog_size)
> >                                      ^
> > > > fs/xfs/xfs_log.c:3573:11: warning: 'ptr' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
> >      for (ptr += BBSIZE; ptr < base_ptr + count; ptr += BBSIZE) {
> >               ^
> > > > fs/xfs/xfs_log.c:3573:37: warning: 'base_ptr' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
> >      for (ptr += BBSIZE; ptr < base_ptr + count; ptr += BBSIZE) {
> >                                         ^
> >     fs/xfs/xfs_log.c:3626:7: warning: 'ptr' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer]
> >       ptr += sizeof(xlog_op_header_t) + op_len;
> >           ^
> > > > fs/xfs/xfs_log.c:3572:4: warning: Variable 'p' is assigned a value that is never used. [unreadVariable]
> >      p = &iclog->ic_header;
> >        ^
> > > > fs/xfs/xfs_log.c:3582:9: warning: Variable 'ophead' is assigned a value that is never used. [unreadVariable]
> >      ophead = ptr;
> >             ^
> >     nofile:0:0: warning: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]
> > --
> >     fs/xfs/scrub/agheader.c:66:12: warning: The scope of the variable 'v2_ok' can be reduced. [variableScope]
> >      uint32_t  v2_ok;
> >                ^
> > > > fs/xfs/scrub/agheader.c:791:14: warning: Variable 'error' is assigned a value that is never used. [unreadVariable]
> >      int   error = 0;
> >                  ^
> > --
> > > > fs/xfs/scrub/health.c:134:23: warning: The expression 'error == 0' is always true. [knownConditionTrueFalse]
> >      for (agno = 0; error == 0 && agno < mp->m_sb.sb_agcount; agno++) {
> >                           ^
> >     fs/xfs/scrub/health.c:130:16: note: 'error' is assigned value '0' here.
> >      int   error = 0;
> >                    ^
> >     fs/xfs/scrub/health.c:134:23: note: The expression 'error == 0' is always true.
> >      for (agno = 0; error == 0 && agno < mp->m_sb.sb_agcount; agno++) {
> >                           ^
> >     fs/xfs/scrub/health.c:128:20: warning: The scope of the variable 'pag' can be reduced. [variableScope]
> >      struct xfs_perag *pag;
> >                        ^
> >     fs/xfs/scrub/health.c:303:20: warning: The scope of the variable 'pag' can be reduced. [variableScope]
> >      struct xfs_perag *pag;
> >                        ^
> > --
> >     fs/xfs/scrub/bmap_repair.c:207:8: warning: The scope of the variable 'error' can be reduced. [variableScope]
> >      int   error = 0;
> >            ^
> >     fs/xfs/scrub/bmap_repair.c:303:8: warning: The scope of the variable 'error' can be reduced. [variableScope]
> >      int   error;
> >            ^
> > > > fs/xfs/scrub/bmap_repair.c:207:14: warning: Variable 'error' is assigned a value that is never used. [unreadVariable]
> >      int   error = 0;
> >                  ^
> > --
> > > > fs/xfs/scrub/ialloc_repair.c:224:14: warning: Variable 'error' is assigned a value that is never used. [unreadVariable]
> >      int   error = 0;
> >                  ^
> > --
> > > > fs/xfs/scrub/rmap_repair.c:199:16: warning: Argument 'error==0' to function ASSERT is always 0 [constArgument]
> >       ASSERT(error == 0);
> >                    ^
> >     fs/xfs/scrub/rmap_repair.c:198:6: note: Assuming that condition 'error' is not redundant
> >      if (error)
> >          ^
> >     fs/xfs/scrub/rmap_repair.c:199:16: note: Argument 'error==0' to function ASSERT is always 0
> >       ASSERT(error == 0);
> >                    ^
> >     fs/xfs/scrub/rmap_repair.c:203:16: warning: Argument 'error==0' to function ASSERT is always 0 [constArgument]
> >       ASSERT(error == 0);
> >                    ^
> >     fs/xfs/scrub/rmap_repair.c:202:6: note: Assuming that condition 'error' is not redundant
> >      if (error)
> >          ^
> >     fs/xfs/scrub/rmap_repair.c:203:16: note: Argument 'error==0' to function ASSERT is always 0
> >       ASSERT(error == 0);
> >                    ^
> > --
> > > > fs/xfs/scrub/symlink_repair.c:210:8: warning: Variable 'error' is reassigned a value before the old one has been used. [redundantAssignment]
> >      error = xfs_symlink_write_target(sc->tp, sc->ip, sc->buf, target_len,
> >            ^
> >     fs/xfs/scrub/symlink_repair.c:206:8: note: error is assigned
> >      error = xfs_trans_reserve_quota_nblks(sc->tp, sc->ip, resblks, 0,
> >            ^
> >     fs/xfs/scrub/symlink_repair.c:210:8: note: error is overwritten
> >      error = xfs_symlink_write_target(sc->tp, sc->ip, sc->buf, target_len,
> >            ^
> >     fs/xfs/scrub/symlink_repair.c:56:16: warning: The scope of the variable 'byte_cnt' can be reduced. [variableScope]
> >      unsigned int  byte_cnt;
> >                    ^
> >     fs/xfs/scrub/symlink_repair.c:57:9: warning: The scope of the variable 'magic_ok' can be reduced. [variableScope]
> >      bool   magic_ok;
> >             ^
> >     fs/xfs/scrub/symlink_repair.c:58:9: warning: The scope of the variable 'hdr_ok' can be reduced. [variableScope]
> >      bool   hdr_ok;
> >             ^
> > 
> > vim +/error +791 fs/xfs/scrub/agheader.c
> > 
> >     783	
> >     784	/* Check agi_[fi]blocks against tree size */
> >     785	static inline void
> >     786	xchk_agi_xref_fiblocks(
> >     787		struct xfs_scrub	*sc)
> >     788	{
> >     789		struct xfs_agi		*agi = sc->sa.agi_bp->b_addr;
> >     790		xfs_agblock_t		blocks;
> >   > 791		int			error = 0;
> >     792	
> >     793		if (!xfs_sb_version_hasinobtcounts(&sc->mp->m_sb))
> >     794			return;
> >     795	
> >     796		if (sc->sa.ino_cur) {
> >     797			error = xfs_btree_count_blocks(sc->sa.ino_cur, &blocks);
> >     798			if (!xchk_should_check_xref(sc, &error, &sc->sa.ino_cur))
> >     799				return;
> >     800			if (blocks != be32_to_cpu(agi->agi_iblocks))
> >     801				xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp);
> >     802		}
> >     803	
> >     804		if (sc->sa.fino_cur) {
> >     805			error = xfs_btree_count_blocks(sc->sa.fino_cur, &blocks);
> >     806			if (!xchk_should_check_xref(sc, &error, &sc->sa.fino_cur))
> >     807				return;
> >     808			if (blocks != be32_to_cpu(agi->agi_fblocks))
> >     809				xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp);
> >     810		}
> >     811	}
> >     812	
> > 
> > ---
> > 0-DAY CI Kernel Test Service, Intel Corporation
> > https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
> > _______________________________________________
> > kbuild-all mailing list -- kbuild-all(a)lists.01.org
> > To unsubscribe send an email to kbuild-all-leave(a)lists.01.org
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-20 16:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-13  2:24 [djwong-xfs:refactor-log-recovery 222/314] fs/xfs/scrub/agheader.c:791:14: warning: Variable 'error' is assigned a value that is never used. [unreadVariable] kbuild test robot
2020-04-15  9:08 ` Rong Chen
2020-04-20 16:46   ` Darrick J. Wong

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.