diff --git a/host/utilities/bladeRF-fsk/c/src/phy.c b/host/utilities/bladeRF-fsk/c/src/phy.c index b3392dbb..559f73de 100644 --- a/host/utilities/bladeRF-fsk/c/src/phy.c +++ b/host/utilities/bladeRF-fsk/c/src/phy.c @@ -735,6 +735,10 @@ void *phy_receive_frames(void *arg) CHECK_FRAME_TYPE, DECODE, COPY}; enum states state; //current state variable + /* corr_process() takes a size_t count. + * Ensure a cast from uint64_t to size_t is valid. */ + assert(NUM_SAMPLES_RX < SIZE_MAX); + //Allocate memory for buffer rx_buffer = malloc(MAX_LINK_FRAME_SIZE); if (rx_buffer == NULL){ @@ -804,7 +808,7 @@ void *phy_receive_frames(void *arg) //DEBUG_MSG("[PHY] RX: State = PREAMBLE_CORRELATE\n"); samples_index = corr_process(phy->rx->corr, &(phy->rx->pnorm_samples[samples_index]), - NUM_SAMPLES_RX-samples_index, 0); + (size_t) (NUM_SAMPLES_RX-samples_index), 0); if (samples_index != CORRELATOR_NO_RESULT){ DEBUG_MSG("[PHY] RX: Preamble matched @ index %lu\n", samples_index); preamble_detected = true;