Hello,
I just run cppcheck on current openzfs master. I know there are several
static analyzer like clang, coverity etc.
i include the log from cppcheck. (I know a static analyzer is not 100%
correct but maybe there are some interesting things you can find and fix):
usr\src\cmd\zdump\zdump.c,115,warning,Either the condition 'tp!=0' is
redundant or there is possible null pointer dereference: tp.
usr\src\cmd\mdb\common\module\zfs\zfs.c,3342,style,struct member
'Anonymous4::b_pdata' is never used.
usr\src\cmd\mdb\common\module\zfs\zfs.c,1235,style,Array index 'i' is used
before limits check.
usr\src\cmd\mdb\common\module\zfs\zfs.c,638,style,Clarify calculation
precedence for '&' and '?'.
usr\src\cmd\mdb\common\module\zfs\zfs.c,2821,error,Uninitialized variable:
db_data
usr\src\cmd\zdb\zdb.c,292,warning,%u in format string (no. 1) requires
'unsigned int' but the argument type is 'signed int'.
usr\src\cmd\zdb\zdb.c,473,warning,%u in format string (no. 1) requires
'unsigned int' but the argument type is 'int'.
usr\src\cmd\zdb\zdb.c,492,warning,%u in format string (no. 1) requires
'unsigned int' but the argument type is 'int'.
usr\src\cmd\zdb\zdb.c,1177,warning,%u in format string (no. 1) requires
'unsigned int' but the argument type is 'signed int'.
usr\src\cmd\zdb\zdb.c,1496,warning,%u in format string (no. 1) requires
'unsigned int' but the argument type is 'int'.
usr\src\cmd\zdb\zdb.c,1557,warning,snprintf format string requires 1
parameter but 2 are given.
usr\src\cmd\zdb\zdb.c,2493,warning,%u in format string (no. 3) requires
'unsigned int' but the argument type is 'signed int'.
usr\src\cmd\zdb\zdb.c,2493,warning,%u in format string (no. 4) requires
'unsigned int' but the argument type is 'signed int'.
usr\src\cmd\zdb\zdb.c,2493,warning,%u in format string (no. 5) requires
'unsigned int' but the argument type is 'signed int'.
usr\src\cmd\zdb\zdb.c,3197,warning,Either the condition 's' is redundant or
there is possible null pointer dereference: s.
usr\src\cmd\zdb\zdb.c,284,style,Array index 'i' is used before limits check.
usr\src\cmd\zdb\zdb.c,2034,style,Obsolete function 'asctime' called. It is
recommended to use 'strftime' instead.
usr\src\cmd\zinject\zinject.c,1071,error,Uninitialized variable: dataset
usr\src\cmd\zfs\zfs_main.c,1303,warning,%llu in format string (no. 1)
requires 'unsigned long long' but the argument type is'signed long long'.
usr\src\cmd\zfs\zfs_main.c,2010,warning,%u in format string (no. 1)
requires 'unsigned int' but the argument type is 'int'.
usr\src\cmd\zfs\zfs_main.c,4431,warning,Possible null pointer dereference:
who_perm
usr\src\cmd\zfs\zfs_main.c,4432,warning,Possible null pointer dereference:
who_perm
usr\src\cmd\zfs\zfs_main.c,4433,warning,Possible null pointer dereference:
who_perm
usr\src\cmd\zfs\zfs_main.c,2177,style,Variable 'ret' is reassigned a value
before the old one has been used.
usr\src\cmd\zpool\zpool_main.c,1870,style,Obsolete function 'asctime'
called. It is recommended to use 'strftime' instead.
usr\src\cmd\zpool\zpool_vdev.c,1252,error,Memory leak: child
usr\src\cmd\ztest\ztest.c,4499,error,Uninitialized variable: error
usr\src\lib\libzfs\common\libzfs_pool.c,1447,error,Null pointer dereference
usr\src\lib\libzfs\common\libzfs_pool.c,1508,error,Null pointer dereference
usr\src\lib\libzfs\common\libzfs_sendrecv.c,2154,warning,%u in format
string (no. 4) requires 'unsigned int' but the argument type is 'int'.
usr\src\lib\libzfs\common\libzfs_sendrecv.c,3324,error,Dereferencing 'cp'
after it is deallocated / released
usr\src\test\zfs-tests\cmd\file_trunc\file_trunc.c,84,style,Variable 'fd'
is reassigned a value before the old one has been used.
usr\src\test\zfs-tests\cmd\getholes\getholes.c,76,style,Condition '0==bs'
is always true
usr\src\test\zfs-tests\cmd\mkbusy\mkbusy.c,138,performance,Buffer 'fpath'
is being written before its old content has been used.
usr\src\test\zfs-tests\cmd\randfree_file\randfree_file.c,87,error,Memory
leak: buf
usr\src\test\zfs-tests\cmd\readmmap\readmmap.c,83,warning,%u in format
string (no. 2) requires 'unsigned int' but the argument type is 'size_t
{aka unsigned long long}'.
usr\src\test\zfs-tests\cmd\readmmap\readmmap.c,114,warning,%u in format
string (no. 2) requires 'unsigned int' but the argument type is 'size_t
{aka unsigned long long}'.
usr\src\test\zfs-tests\cmd\readmmap\readmmap.c,120,warning,%u in format
string (no. 1) requires 'unsigned int' but the argument type is 'size_t
{aka unsigned long long}'.
usr\src\test\zfs-tests\cmd\readmmap\readmmap.c,127,warning,%u in format
string (no. 1) requires 'unsigned int' but the argument type is 'size_t
{aka unsigned long long}'.
usr\src\uts\common\fs\zfs\dbuf.c,2529,style,Label 'top' is not used.
usr\src\uts\common\fs\zfs\arc.c,2464,warning,Either the condition
'lastbuf!=0' is redundant or there is possible null pointer dereference:
buf.
usr\src\uts\common\fs\zfs\arc.c,2464,warning,Either the condition
'lastbuf!=0' is redundant or there is possible null pointer dereference:
buf.
usr\src\uts\common\fs\zfs\arc.c,2464,warning,Either the condition
'lastbuf!=0' is redundant or there is possible null pointer dereference:
buf.
usr\src\uts\common\fs\zfs\arc.c,6592,style,Variable 'dev.l2ad_writing' is
reassigned a value before the old one has been used.
usr\src\uts\common\fs\zfs\arc.c,921,style,struct member
'arc_buf_hdr::b_psize' is never used.
usr\src\uts\common\fs\zfs\arc.c,928,style,struct member
'arc_buf_hdr::b_lsize' is never used.
usr\src\uts\common\fs\zfs\arc.c,3559,style,Unused variable: n
usr\src\uts\common\fs\zfs\arc.c,990,style,struct member 'ht_lock::pad' is
never used.
usr\src\uts\common\fs\zfs\dmu_tx.c,817,style,Variable 'err' is assigned a
value that is never used.
usr\src\uts\common\fs\zfs\dmu_tx.c,925,warning,Either the condition 'dn==0'
is redundant or there is possible null pointer dereference: dn.
usr\src\uts\common\fs\zfs\dmu_tx.c,925,warning,Either the condition 'dn==0'
is redundant or there is possible null pointer dereference: dn.
usr\src\uts\common\fs\zfs\dnode.c,2031,style,Clarify calculation precedence
for '&' and '?'.
usr\src\uts\common\fs\zfs\dnode.c,693,style,struct member
'Anonymous0::dms_dnode_invalid' is never used.
usr\src\uts\common\fs\zfs\dnode.c,694,style,struct member
'Anonymous0::dms_dnode_recheck1' is never used.
usr\src\uts\common\fs\zfs\dnode.c,695,style,struct member
'Anonymous0::dms_dnode_recheck2' is never used.
usr\src\uts\common\fs\zfs\dnode.c,696,style,struct member
'Anonymous0::dms_dnode_special' is never used.
usr\src\uts\common\fs\zfs\dnode.c,697,style,struct member
'Anonymous0::dms_dnode_handle' is never used.
usr\src\uts\common\fs\zfs\dnode.c,698,style,struct member
'Anonymous0::dms_dnode_rwlock' is never used.
usr\src\uts\common\fs\zfs\dnode.c,699,style,struct member
'Anonymous0::dms_dnode_active' is never used.
usr\src\uts\common\fs\zfs\dsl_destroy.c,241,style,Unused variable: err
usr\src\uts\common\fs\zfs\dsl_pool.c,396,style,Variable 'os' is assigned a
value that is never used.
usr\src\uts\common\fs\zfs\metaslab.c,2716,warning,Either the condition
'hintbp==0' is redundant or there is possible null pointer dereference:
hintbp.
usr\src\uts\common\fs\zfs\metaslab.c,2675,style,Variable 'reserved_slots'
is assigned a value that is never used.
usr\src\uts\common\fs\zfs\sa.c,1365,style,Unused variable: doi
usr\src\uts\common\fs\zfs\spa.c,391,style,Label 'out' is not used.
usr\src\uts\common\fs\zfs\vdev.c,2108,style,Variable 'vd.vdev_cant_read' is
reassigned a value before the old one has been used.
usr\src\uts\common\fs\zfs\vdev_raidz.c,1592,style,Variable 'tvd' is
assigned a value that is never used.
usr\src\uts\common\fs\zfs\vdev_raidz.c,1593,style,Unused variable: cvd
usr\src\uts\common\fs\zfs\vdev_raidz.c,1594,style,Unused variable: rm
usr\src\uts\common\fs\zfs\vdev_raidz.c,1595,style,Unused variable: rc
usr\src\uts\common\fs\zfs\vdev_raidz.c,1596,style,Unused variable: c
usr\src\uts\common\fs\zfs\vdev_raidz.c,1598,style,Unused variable: start
usr\src\uts\common\fs\zfs\vdev_raidz.c,1598,style,Unused variable: end
usr\src\uts\common\fs\zfs\vdev_raidz.c,1598,style,Unused variable: colstart
usr\src\uts\common\fs\zfs\vdev_raidz.c,1598,style,Unused variable: colend
usr\src\uts\common\fs\zfs\vdev_raidz.c,1599,style,Unused variable: coloffset
usr\src\uts\common\fs\zfs\vdev_raidz.c,1599,style,Unused variable: colsize
usr\src\uts\common\fs\zfs\vdev_raidz.c,1599,style,Unused variable: colskip
usr\src\uts\common\fs\zfs\vdev_raidz.c,1601,style,Variable 'flags' is
assigned a value that is never used.
usr\src\uts\common\fs\zfs\zfs_acl.c,2015,style,Label 'done' is not used.
usr\src\uts\common\fs\zfs\zfs_dir.c,932,style,Unused variable: parent
usr\src\uts\common\fs\zfs\zfs_log.c,258,warning,Either the condition
'fuidp' is redundant or there is possible null pointer dereference: fuidp.
usr\src\uts\common\fs\zfs\zfs_log.c,258,warning,Either the condition
'fuidp' is redundant or there is possible null pointer dereference: fuidp.
usr\src\uts\common\fs\zfs\zfs_ioctl.c,3152,style,Variable 'zplver' is
reassigned a value before the old one has been used.
usr\src\uts\common\fs\zfs\zfs_vnops.c,723,style,Clarify calculation
precedence for '&' and '?'.
usr\src\uts\common\fs\zfs\zfs_vnops.c,3730,style,Clarify calculation
precedence for '&' and '?'.
usr\src\uts\common\fs\zfs\zfs_znode.c,1122,style,Redundant condition:
doi.doi_bonus_type==DMU_OT_ZNODE. 'A || (!A && B)' is equivalent to 'A || B'
usr\src\uts\common\fs\zfs\zfs_znode.c,1211,style,Redundant condition:
doi.doi_bonus_type==DMU_OT_ZNODE. 'A || (!A && B)' is equivalent to 'A || B'
usr\src\uts\common\fs\zfs\zio_checksum.c,348,style,Variable 'eck.zec_cksum'
is reassigned a value before the old one has been used.
usr\src\uts\common\fs\zfs\zvol.c,782,style,Variable 'old_volsize' is
reassigned a value before the old one has been used.
usr\src\uts\common\fs\zfs\zvol.c,1261,style,Checking if unsigned variable
'off' is less than zero.
-------------------------------------------
openzfs-developer
Archives: https://www.listbox.com/member/archive/274414/=now
RSS Feed: https://www.listbox.com/member/archive/rss/274414/28015062-cce53afa
Modify Your Subscription:
https://www.listbox.com/member/?member_id=28015062&id_secret=28015062-f966d51c
Powered by Listbox: http://www.listbox.com