Skip to content

Commit c4eb607

Browse files
zeldinzougloub
authored andcommitted
fx2lafw: Limit combined size of all requests to 16M
1 parent fd07bf1 commit c4eb607

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/hardware/fx2lafw/protocol.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,11 @@ static unsigned int get_number_of_transfers(struct dev_context *devc)
617617
n = (500 * to_bytes_per_ms(devc->cur_samplerate, devc->unitsize) /
618618
get_buffer_size(devc));
619619

620+
/* But no larger than 16M */
621+
unsigned int nmax = MAX_BULK_REQUEST_SIZE / get_buffer_size(devc);
622+
if (n > nmax)
623+
n = nmax;
624+
620625
if (n > NUM_SIMUL_TRANSFERS)
621626
return NUM_SIMUL_TRANSFERS;
622627

src/hardware/fx2lafw/protocol.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#define MAX_RENUM_DELAY_MS 3000
3939
#define NUM_SIMUL_TRANSFERS 32
4040
#define MAX_EMPTY_TRANSFERS (NUM_SIMUL_TRANSFERS * 2)
41+
#define MAX_BULK_REQUEST_SIZE 16000000
4142

4243
#define NUM_CHANNELS 16
4344

0 commit comments

Comments
 (0)