diff options
author | Tuomas Taipale <tuomas.taipale@nokia.com> | 2023-05-23 08:21:10 +0000 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2023-05-23 15:22:38 +0300 |
commit | 9b7baf5f9abfb77e3e1b42e24cf5b612a15144b4 (patch) | |
tree | f890b28ee26e8d756dd67abd70d328c35fb00402 /test | |
parent | 4ca65d1f8e3e5032f6b367935067e55ba415d75a (diff) |
test: dma_perf: fix potential overflows
Fix a few potential integer overflows reported by Coverity.
Signed-off-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/performance/odp_dma_perf.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/test/performance/odp_dma_perf.c b/test/performance/odp_dma_perf.c index 342b0b815..be23f27ca 100644 --- a/test/performance/odp_dma_perf.c +++ b/test/performance/odp_dma_perf.c @@ -485,7 +485,8 @@ static parse_result_t check_options(prog_config_t *config) return PRS_NOT_SUP; } - shm_size = config->dst_seg_len * config->num_out_segs * config->num_inflight; + shm_size = (uint64_t)config->dst_seg_len * config->num_out_segs * + config->num_inflight; if (shm_capa.max_size != 0U && shm_size > shm_capa.max_size) { ODPH_ERR("Unsupported total SHM block size: %" PRIu64 "" @@ -721,7 +722,7 @@ static void free_packets(const sd_t *sd) static odp_bool_t allocate_memory(sd_t *sd) { - const uint64_t num_segs = sd->dma.num_in_segs * sd->dma.num_inflight; + const uint64_t num_segs = (uint64_t)sd->dma.num_in_segs * sd->dma.num_inflight; sd->seg.src_shm = odp_shm_reserve(PROG_NAME "_src_shm", sd->dma.src_seg_len * num_segs, ODP_CACHE_LINE_SIZE, 0U); |