snikeguo opened a new issue, #16784:
URL: https://github.com/apache/nuttx/issues/16784

   ### 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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to