-
Notifications
You must be signed in to change notification settings - Fork 159
Description
Hi,
In function process_write_data, repeat condition may lead to while(1).
Suppose that user does not specify --tx-bytes:
int repeat = (_cl_tx_bytes == 0);
so the repeat condition will be 1 and if the following condition is not satisfied, we will stuck in while(1)
if (c < actual_write_size) { _write_count_value = _write_data[c]; repeat = 0; }
If driver can send all data, then c = actual_write_size which leads the condition not being satisfied and we stuck in while(1)
But the question is that why does it work with some devices?
I guess that's because drivers can't send 1024bytes in ONE round (the remaining will be send in the next round ... handled in userspace) and the c < actual_write_size is satisfied and we don't stuck in while(1). But what if the driver can send 1024bytes? Unfortunately, it will get stuck in while(1)
I fixed this issue by simply replacing < with <=. Here is the modification:
if (c <= actual_write_size) { _write_count_value = _write_data[c]; repeat = 0; }