Skip to content

Commit

Permalink
Cleanup: Use MIN() macro
Browse files Browse the repository at this point in the history
The Linux 5.16.14 kernel's coccicheck caught this. The semantic
patch that caught it was:

./scripts/coccinelle/misc/minmax.cocci

There was a third opportunity to use `MIN()`, but that was in
`FSE_minTableLog()` in `module/zstd/lib/compress/fse_compress.c`.
Upstream zstd has yet to make this change and I did not want to change
header includes just for MIN, or do a one off, so I left it alone.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes openzfs#14372
  • Loading branch information
ryao authored and lundman committed Mar 3, 2023
1 parent 2a15314 commit 05f9141
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion module/icp/algs/modes/ccm.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ ccm_format_initial_blocks(uchar_t *nonce, ulong_t nonceSize,
memset(&(b0[1+nonceSize]), 0, q);

payloadSize = aes_ctx->ccm_data_len;
limit = 8 < q ? 8 : q;
limit = MIN(8, q);

for (i = 0, j = 0, k = 15; i < limit; i++, j += 8, k--) {
b0[k] = (uint8_t)((payloadSize >> j) & 0xFF);
Expand Down
3 changes: 1 addition & 2 deletions module/zfs/dmu_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -1842,8 +1842,7 @@ send_reader_thread(void *arg)
continue;
}
uint64_t file_max =
(dn->dn_maxblkid < range->end_blkid ?
dn->dn_maxblkid : range->end_blkid);
MIN(dn->dn_maxblkid, range->end_blkid);
/*
* The object exists, so we need to try to find the
* blkptr for each block in the range we're processing.
Expand Down

0 comments on commit 05f9141

Please sign in to comment.