Skip to content

Commit

Permalink
Update checkstyle workflow env to ubuntu-20.04
Browse files Browse the repository at this point in the history
- `checkstyle` workflow uses ubuntu-20.04 environment
- improved `mancheck.sh` readability

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: szubersk <szuberskidamian@gmail.com>
Closes openzfs#12713
  • Loading branch information
szubersk authored and tonyhutter committed Nov 12, 2021
1 parent 72d8765 commit 0a11bc8
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/checkstyle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
checkstyle:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion cmd/zdb/zdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -4089,7 +4089,7 @@ cksum_record_compare(const void *x1, const void *x2)
const cksum_record_t *l = (cksum_record_t *)x1;
const cksum_record_t *r = (cksum_record_t *)x2;
int arraysize = ARRAY_SIZE(l->cksum.zc_word);
int difference;
int difference = 0;

for (int i = 0; i < arraysize; i++) {
difference = TREE_CMP(l->cksum.zc_word[i], r->cksum.zc_word[i]);
Expand Down
2 changes: 2 additions & 0 deletions include/sys/zstd/zstd.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,14 @@ zfs_get_hdrversion(const zfs_zstdhdr_t *blob)
static inline void
zfs_set_hdrversion(zfs_zstdhdr_t *blob, uint32_t version)
{
/* cppcheck-suppress syntaxError */
BF32_SET(blob->raw_version_level, 0, 24, version);
}

static inline void
zfs_set_hdrlevel(zfs_zstdhdr_t *blob, uint8_t level)
{
/* cppcheck-suppress syntaxError */
BF32_SET(blob->raw_version_level, 24, 8, level);
}

Expand Down
4 changes: 3 additions & 1 deletion module/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ modules_uninstall: modules_uninstall-@ac_system@

cppcheck-Linux:
@CPPCHECK@ -j@CPU_COUNT@ --std=c99 --quiet --force --error-exitcode=2 \
--inline-suppr --suppress=noValidConfiguration \
--inline-suppr \
--suppress=unmatchedSuppression \
--suppress=noValidConfiguration \
--enable=warning,information -D_KERNEL \
--include=@LINUX_OBJ@/include/generated/autoconf.h \
--include=@top_srcdir@/zfs_config.h \
Expand Down
6 changes: 5 additions & 1 deletion module/nvpair/nvpair.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,12 +533,14 @@ nvt_add_nvpair(nvlist_t *nvl, nvpair_t *nvp)
uint64_t index = hash & (priv->nvp_nbuckets - 1);

ASSERT3U(index, <, priv->nvp_nbuckets);
// cppcheck-suppress nullPointerRedundantCheck
i_nvp_t *bucket = tab[index];

/* insert link at the beginning of the bucket */
i_nvp_t *new_entry = NVPAIR2I_NVP(nvp);
ASSERT3P(new_entry->nvi_hashtable_next, ==, NULL);
new_entry->nvi_hashtable_next = bucket;
// cppcheck-suppress nullPointerRedundantCheck
tab[index] = new_entry;

priv->nvp_nentries++;
Expand Down Expand Up @@ -3220,6 +3222,8 @@ nvs_xdr_nvl_fini(nvstream_t *nvs)
static int
nvs_xdr_nvp_op(nvstream_t *nvs, nvpair_t *nvp)
{
ASSERT(nvs != NULL && nvp != NULL);

data_type_t type;
char *buf;
char *buf_end = (char *)nvp + nvp->nvp_size;
Expand All @@ -3228,7 +3232,7 @@ nvs_xdr_nvp_op(nvstream_t *nvs, nvpair_t *nvp)
bool_t ret = FALSE;
XDR *xdr = nvs->nvs_private;

ASSERT(xdr != NULL && nvp != NULL);
ASSERT(xdr != NULL);

/* name string */
if ((buf = NVP_NAME(nvp)) >= buf_end)
Expand Down
1 change: 0 additions & 1 deletion module/os/freebsd/zfs/vdev_geom.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ vdev_geom_orphan(struct g_consumer *cp)
* async removal support to invoke a close on this
* vdev once it is safe to do so.
*/
// cppcheck-suppress All
SLIST_FOREACH(elem, priv, elems) {
// cppcheck-suppress uninitvar
vdev_t *vd = elem->vd;
Expand Down
1 change: 1 addition & 0 deletions module/os/linux/spl/spl-generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@ hostid_read(uint32_t *hostid)
return (error);
}
size = stat.size;
// cppcheck-suppress sizeofwithnumericparameter
if (size < sizeof (HW_HOSTID_MASK)) {
filp_close(filp, 0);
return (EINVAL);
Expand Down
4 changes: 4 additions & 0 deletions module/unicode/u8_textprep.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,9 @@ do_decomp(size_t uv, uchar_t *u8s, uchar_t *s, int sz,
start_id = u8_decomp_b4_16bit_tbl[uv][b3_tbl][b4];
end_id = u8_decomp_b4_16bit_tbl[uv][b3_tbl][b4 + 1];
} else {
// cppcheck-suppress arrayIndexOutOfBoundsCond
start_id = u8_decomp_b4_tbl[uv][b3_tbl][b4];
// cppcheck-suppress arrayIndexOutOfBoundsCond
end_id = u8_decomp_b4_tbl[uv][b3_tbl][b4 + 1];
}

Expand Down Expand Up @@ -1012,7 +1014,9 @@ find_composition_start(size_t uv, uchar_t *s, size_t sz)
start_id = u8_composition_b4_16bit_tbl[uv][b3_tbl][b4];
end_id = u8_composition_b4_16bit_tbl[uv][b3_tbl][b4 + 1];
} else {
// cppcheck-suppress arrayIndexOutOfBoundsCond
start_id = u8_composition_b4_tbl[uv][b3_tbl][b4];
// cppcheck-suppress arrayIndexOutOfBoundsCond
end_id = u8_composition_b4_tbl[uv][b3_tbl][b4 + 1];
}

Expand Down

0 comments on commit 0a11bc8

Please sign in to comment.