[BUG] uart_recvchars_dma may cause address missalignment issues.
- Dominant language
- C
- Stars
- 4k
- Forks
- 1.7k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 237
Description
### Description / Steps to reproduce the issue
```
void uart_recvchars_dma(FAR uart_dev_t *dev)
{
···
if (rxbuf->tail <= rxbuf->head)
{
xfer->buffer = &rxbuf->buffer[rxbuf->head];
xfer->nbuffer = rxbuf->buffer;
if (rxbuf->tail > 0)
{
xfer->length = rxbuf->size - rxbuf->head;
xfer->nlength = rxbuf->tail - 1;
}
else
{
xfer->length = rxbuf->size - rxbuf->head - 1;
xfer->nlength = 0;
}
}
else
{
xfer->buffer = &rxbuf->buffer[rxbuf->head];
xfer->length = rxbuf->tail - rxbuf->head - 1;
xfer->nbuffer = NULL;
xfer->nlength = 0;
}
uart_dmareceive(dev);
}
```
The head is the write pointer and is initially 0. For example, after receiving three bytes, the head becomes 3, which may cause the underlying DMA setup to fail.
### On which OS does this issue occur?
[OS: BSD]
### What is the version of your OS?
all os
### NuttX Version
last
### Issue Architecture
[Arch: all]
### Issue Area
[Area: Drivers]
### Host information
_No response_
### Verification
- [x] I have verified before submitting the report.
Contributor guide
Assessment
This issue has not been assessed yet.