summaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorJacob Keller <jacob.e.keller@intel.com>2022-11-28 12:36:39 -0800
committerJakub Kicinski <kuba@kernel.org>2022-11-30 20:54:29 -0800
commit28e0c250f17ab3b6eb4dcee1a8208125bc77c61e (patch)
treef888563c3216e46a2eaf75ca5b99efe588399c1e /net/core
parentc1d8e3fb1a3bef6d1b24a9b1326e4ed11a1fbf0b (diff)
devlink: use min_t to calculate data_size
The calculation for the data_size in the devlink_nl_read_snapshot_fill function uses an if statement that is better expressed using the min_t macro. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Acked-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/devlink.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 0e10a8a68c5e..6ef9974f5357 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -6485,10 +6485,8 @@ static int devlink_nl_region_read_snapshot_fill(struct sk_buff *skb,
u32 data_size;
u8 *data;
- if (end_offset - curr_offset < DEVLINK_REGION_READ_CHUNK_SIZE)
- data_size = end_offset - curr_offset;
- else
- data_size = DEVLINK_REGION_READ_CHUNK_SIZE;
+ data_size = min_t(u32, end_offset - curr_offset,
+ DEVLINK_REGION_READ_CHUNK_SIZE);
data = &snapshot->data[curr_offset];
err = devlink_nl_cmd_region_read_chunk_fill(skb, devlink,