-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
It seems like the following code (dma-proxy-test.c) may be incorrect and appears to lead to issues that eventually result in a kernel panic if the test is run multiple times.
Line 422
for (i = 0; i < TX_CHANNEL_COUNT; i++) {
pthread_join(tx_channels[i].tid, NULL);
munmap(tx_channels[i].buf_ptr, sizeof(struct channel_buffer));
close(tx_channels[i].fd);
}
for (i = 0; i < RX_CHANNEL_COUNT; i++) {
munmap(rx_channels[i].buf_ptr, sizeof(struct channel_buffer));
close(rx_channels[i].fd);
}
I believe the code should be:
for (i = 0; i < TX_CHANNEL_COUNT; i++) {
pthread_join(tx_channels[i].tid, NULL);
munmap(tx_channels[i].buf_ptr, sizeof(struct channel_buffer)* TX_BUFFER_COUNT);
close(tx_channels[i].fd);
}
for (i = 0; i < RX_CHANNEL_COUNT; i++) {
munmap(rx_channels[i].buf_ptr, sizeof(struct channel_buffer)* RX_BUFFER_COUNT);
close(rx_channels[i].fd);
}
Additionally, line 352:
test_size = atoi(argv[2]);
if (test_size > BUFFER_SIZE)
test_size = BUFFER_SIZE;
test_size *= 1024;
Has a clear bug since BUFFER_SIZE is in Bytes. Code should be
test_size = atoi(argv[2]);
test_size *= 1024;
if (test_size > BUFFER_SIZE)
test_size = BUFFER_SIZE;
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels