From 3b2f9c1ec81a0c7059a81f5b4ae1e8f6296c090b Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Tue, 10 Jan 2023 16:41:26 -0500 Subject: [PATCH] Cleanup: Use MIN() macro 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 Signed-off-by: Richard Yao Closes #14372 --- module/icp/algs/modes/ccm.c | 2 +- module/zfs/dmu_send.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/module/icp/algs/modes/ccm.c b/module/icp/algs/modes/ccm.c index 4a8bb9bbc..1371676d6 100644 --- a/module/icp/algs/modes/ccm.c +++ b/module/icp/algs/modes/ccm.c @@ -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); diff --git a/module/zfs/dmu_send.c b/module/zfs/dmu_send.c index bcbc2ba60..7f8de23f0 100644 --- a/module/zfs/dmu_send.c +++ b/module/zfs/dmu_send.c @@ -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.