radio_dummy: fix potential result overflow by converting to wider type first

master
Andre Puschmann 3 years ago
parent 3fdec57a47
commit 67f66e7d63

@ -162,7 +162,7 @@ public:
} }
// Create receiver ring buffers // Create receiver ring buffers
rx_ring_buffers.resize(args_.nof_carriers * args_.nof_antennas); rx_ring_buffers.resize(args_.nof_carriers * (size_t)args_.nof_antennas);
for (auto& rb : rx_ring_buffers) { for (auto& rb : rx_ring_buffers) {
if (srsran_ringbuffer_init(&rb, (int)sizeof(cf_t) * TEMP_BUFFER_SZ) != SRSRAN_SUCCESS) { if (srsran_ringbuffer_init(&rb, (int)sizeof(cf_t) * TEMP_BUFFER_SZ) != SRSRAN_SUCCESS) {
perror("init softbuffer"); perror("init softbuffer");
@ -170,7 +170,7 @@ public:
} }
// Create transmitter ring buffers // Create transmitter ring buffers
tx_ring_buffers.resize(args_.nof_carriers * args_.nof_antennas); tx_ring_buffers.resize(args_.nof_carriers * (size_t)args_.nof_antennas);
for (auto& rb : tx_ring_buffers) { for (auto& rb : tx_ring_buffers) {
if (srsran_ringbuffer_init(&rb, (int)sizeof(cf_t) * TEMP_BUFFER_SZ) != SRSRAN_SUCCESS) { if (srsran_ringbuffer_init(&rb, (int)sizeof(cf_t) * TEMP_BUFFER_SZ) != SRSRAN_SUCCESS) {
perror("init softbuffer"); perror("init softbuffer");

Loading…
Cancel
Save