Created attachment 180914 [details] patch related to this issue cppcheck findings on UFS code (patch attached) [sys/ufs/ffs/ffs_softdep.c:1133] -> [sys/ufs/ffs/ffs_softdep.c:1135]: (warning) Either the condition 'wk==NULL' is redundant or there is possible null pointer dereference: wk. [sys/ufs/ffs/ffs_softdep.c:8383] -> [sys/ufs/ffs/ffs_softdep.c:8385]: (warning) Either the condition 'wk==NULL' is redundant or there is possible null pointer dereference: wk.
The report is false, and patch is wrong. The code tries to find a first element of the specific type (D_JSEGDEP in case of jwork_insert, D_ALLOCDIRECT for setup_newdir). This is done by the LIST_FOREACH() loop. If no element was found, i.e. the condition wk == NULL after the loop, then something other is done. The patch breaks the logic.