Message ID | 20221128203647.1198669-2-jacob.e.keller@intel.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 28e0c250f17ab3b6eb4dcee1a8208125bc77c61e |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | support direct read from region | expand |
diff --git a/net/core/devlink.c b/net/core/devlink.c index cea154ddce7a..ff802788ee05 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,