better handling of writeBlockSize greater than samples/slot
fix the case when writeBlockSize is greater than samples/slot by sending samples from the same buffer instead of out-of-bounds memory read
This commit is contained in:
committed by
Roberto Rosca
parent
fc26b8c053
commit
a049c53e99
+15
-3
@@ -483,11 +483,23 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action)
|
||||
}
|
||||
}
|
||||
|
||||
int tmp = openair0_write_reorder(&UE->rfdevice, proc->timestamp_tx, txp, rxtxD->writeBlockSize, fp->nb_antennas_tx, flags);
|
||||
AssertFatal(tmp == rxtxD->writeBlockSize, "");
|
||||
openair0_timestamp writeTimestamp = proc->timestamp_tx;
|
||||
int writeBlockSize = rxtxD->writeBlockSize;
|
||||
if ( writeBlockSize > fp->get_samples_per_slot(proc->nr_slot_tx, fp)) {
|
||||
// if writeBlockSize gets longer that slot size, fill with dummy
|
||||
const int dummyBlockSize = writeBlockSize - fp->get_samples_per_slot(proc->nr_slot_tx, fp);
|
||||
int tmp = openair0_write_reorder(&UE->rfdevice, writeTimestamp, txp, dummyBlockSize, fp->nb_antennas_tx, flags);
|
||||
AssertFatal(tmp == dummyBlockSize, "");
|
||||
|
||||
writeTimestamp += dummyBlockSize;
|
||||
writeBlockSize -= dummyBlockSize;
|
||||
}
|
||||
|
||||
int tmp = openair0_write_reorder(&UE->rfdevice, writeTimestamp, txp, writeBlockSize, fp->nb_antennas_tx, flags);
|
||||
AssertFatal(tmp == writeBlockSize, "");
|
||||
|
||||
for (int i = 0; i < fp->nb_antennas_tx; i++)
|
||||
memset(txp[i], 0, rxtxD->writeBlockSize);
|
||||
memset(txp[i], 0, writeBlockSize);
|
||||
}
|
||||
|
||||
void processSlotTX(void *arg)
|
||||
|
||||
Reference in New Issue
Block a user