Skip to content

Commit e91611e

Browse files
colmbuckleyjsai20
authored andcommitted
Fix two minor lint errors (cppcheck)
Fix two minor errors reported by cppcheck: In module/zfs/abd.c (abd_get_offset_impl), add non-NULL assertion to prevent NULL dereference warning. In module/zfs/arc.c (l2arc_write_buffers), change 'try' variable to 'pass' to avoid C++ reserved word. Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Colm Buckley <[email protected]> Closes openzfs#11507
1 parent cab13d5 commit e91611e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

module/zfs/abd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ abd_get_offset_impl(abd_t *abd, abd_t *sabd, size_t off, size_t size)
526526
abd = abd_get_offset_scatter(abd, sabd, off);
527527
}
528528

529+
ASSERT3P(abd, !=, NULL);
529530
abd->abd_size = size;
530531
abd->abd_parent = sabd;
531532
(void) zfs_refcount_add_many(&sabd->abd_children, abd->abd_size, abd);

module/zfs/arc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9080,17 +9080,17 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz)
90809080
/*
90819081
* Copy buffers for L2ARC writing.
90829082
*/
9083-
for (int try = 0; try < L2ARC_FEED_TYPES; try++) {
9083+
for (int pass = 0; pass < L2ARC_FEED_TYPES; pass++) {
90849084
/*
9085-
* If try == 1 or 3, we cache MRU metadata and data
9085+
* If pass == 1 or 3, we cache MRU metadata and data
90869086
* respectively.
90879087
*/
90889088
if (l2arc_mfuonly) {
9089-
if (try == 1 || try == 3)
9089+
if (pass == 1 || pass == 3)
90909090
continue;
90919091
}
90929092

9093-
multilist_sublist_t *mls = l2arc_sublist_lock(try);
9093+
multilist_sublist_t *mls = l2arc_sublist_lock(pass);
90949094
uint64_t passed_sz = 0;
90959095

90969096
VERIFY3P(mls, !=, NULL);

0 commit comments

Comments
 (0)