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

commit 2a51aa9e1852e95ed5cb0bef381df82887165cb7
Author: jingfei <[email protected]>
AuthorDate: Tue Aug 11 15:23:20 2026 +0800

    drivers/mtd/rpmsgmtd: convert the packed ioctl buffer through void *
    
    msg->buf is a member of a packed structure. The TASKING compiler makes
    its address an __unaligned pointer and refuses to convert that to an
    integer, also via uintptr_t:
    
      ctc E241: ["drivers/mtd/rpmsgmtd_server.c" 340/14] invalid conversion
      from "unsigned char __unaligned *" to "unsigned long int"
    
    Go through (FAR void *) in the server before passing it as the ioctl
    argument, and drop the needless uintptr_t round trip on the client
    reply buffer.
    
    Signed-off-by: jingfei <[email protected]>
    Signed-off-by: Bowen Wang <[email protected]>
---
 drivers/mtd/rpmsgmtd.c        | 2 +-
 drivers/mtd/rpmsgmtd_server.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/rpmsgmtd.c b/drivers/mtd/rpmsgmtd.c
index 89968f7c49b..5959e3bae06 100644
--- a/drivers/mtd/rpmsgmtd.c
+++ b/drivers/mtd/rpmsgmtd.c
@@ -974,7 +974,7 @@ static int rpmsgmtd_ioctl_handler(FAR struct rpmsg_endpoint 
*ept,
   cookie->result = header->result;
   if (cookie->result >= 0 && rsp->arglen > 0)
     {
-      memcpy(cookie->data, (FAR void *)(uintptr_t)rsp->buf, rsp->arglen);
+      memcpy(cookie->data, (FAR void *)rsp->buf, rsp->arglen);
     }
 
   rpmsg_post(ept, &cookie->sem);
diff --git a/drivers/mtd/rpmsgmtd_server.c b/drivers/mtd/rpmsgmtd_server.c
index 8350cd7eaa4..99f2d6a8494 100644
--- a/drivers/mtd/rpmsgmtd_server.c
+++ b/drivers/mtd/rpmsgmtd_server.c
@@ -337,7 +337,8 @@ static int rpmsgmtd_ioctl_handler(FAR struct rpmsg_endpoint 
*ept,
   FAR struct rpmsgmtd_ioctl_s *msg = data;
 
   msg->header.result = MTD_IOCTL(server->dev, msg->request,
-                                 msg->arglen > 0 ? (unsigned long)msg->buf :
+                                 msg->arglen > 0 ?
+                                 (unsigned long)(FAR void *)msg->buf :
                                  msg->arg);
 
   return rpmsg_send(ept, msg, len);

Reply via email to