This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 18767f53182 drivers/serial: cast the winsize ioctl argument through 
uintptr_t
18767f53182 is described below

commit 18767f531829d1ddbadd14534ea6959c7f35427f
Author: zhangyuan29 <[email protected]>
AuthorDate: Fri Nov 13 15:54:10 2026 +0800

    drivers/serial: cast the winsize ioctl argument through uintptr_t
    
    TIOCGWINSZ/TIOCSWINSZ support (1ebffe4cdfc) casts the unsigned long
    ioctl argument straight to struct winsize *.  On targets whose pointers
    are smaller than long, e.g. AVR, this trips -Werror=int-to-pointer-cast
    and breaks every board that enables the serial driver.  Route both
    casts through uintptr_t like every other pointer-taking command in
    uart_ioctl() already does.
    
    Signed-off-by: zhangyuan29 <[email protected]>
---
 drivers/serial/serial.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index 085586300f0..2c68cb6923a 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -2107,7 +2107,7 @@ static int uart_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
 
           case TIOCGWINSZ:
             {
-              FAR struct winsize *ws = (FAR struct winsize *)arg;
+              FAR struct winsize *ws = (FAR struct winsize *)(uintptr_t)arg;
 
               if (ws == NULL)
                 {
@@ -2123,7 +2123,7 @@ static int uart_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
           case TIOCSWINSZ:
             {
               FAR const struct winsize *ws =
-                (FAR const struct winsize *)arg;
+                (FAR const struct winsize *)(uintptr_t)arg;
 
               if (ws == NULL)
                 {

Reply via email to