spdk_top: fix warning on build
During make operation warning -Walloc-size-larger-than is seen. The cause is the type of threads_count variable, which can store value up to MAX_SIZE threshold. The value of the variable is then divided by 8 and multiplied by 32, what exceeds the MAX_SIZE limit. To fix the problem I changed value of threads_count to uint16_t. Its maximum value is closer to that of hard coded limit of threads RPC_MAX_THREADS than size_t. Change-Id: I7c76db21c328166c074d564d9c1d6d29ae8a07da Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11177 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
b7e4940952
commit
8f4c7cc33a
@ -499,7 +499,7 @@ rpc_decode_cores_lw_threads(const struct spdk_json_val *val, void *out)
|
||||
/* The number of thread entries received from RPC can be calculated using
|
||||
* above define value (each JSON line = key + value, hence '* 2' ) and JSON
|
||||
* 'val' value (-2 is to subtract VAL_OBJECT_BEGIN/END). */
|
||||
size_t threads_count = (spdk_json_val_len(val) - 2) / RPC_THREAD_ENTRY_SIZE;
|
||||
uint16_t threads_count = (spdk_json_val_len(val) - 2) / RPC_THREAD_ENTRY_SIZE;
|
||||
|
||||
threads->thread = calloc(threads_count, sizeof(struct rpc_core_thread_info));
|
||||
if (!out) {
|
||||
|
Loading…
Reference in New Issue
Block a user