raiden00pl commented on code in PR #20030:
URL: https://github.com/apache/nuttx/pull/20030#discussion_r3955448443


##########
drivers/serial/serial_io.c:
##########
@@ -57,24 +57,32 @@
 void uart_xmitchars(FAR uart_dev_t *dev)
 {
   uint16_t nbytes = 0;
+  sbuf_size_t head;
 
 #ifdef CONFIG_SMP
   irqstate_t flags = enter_critical_section();
 #endif
 
-  /* Send while we still have data in the TX buffer & room in the fifo */
+  /* Send while we still have data in the TX buffer & room in the fifo.
+   *
+   * uart_putxmitchar() advances xmit.head from thread context without
+   * holding the critical section, so on SMP it can move (and wrap) while

Review Comment:
   the producer writes head outside any lock. This ring is a 
single-producer/single-consumer ring:
   
   
https://github.com/apache/nuttx/blob/35e8eebff3a1e04cb55943351f339353e81f6653/drivers/serial/serial.c#L279-L286
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to