diff --git a/drivers/rptun/rptun.c b/drivers/rptun/rptun.c index 256475a7c14..c350547bd0e 100644 --- a/drivers/rptun/rptun.c +++ b/drivers/rptun/rptun.c @@ -39,6 +39,10 @@ #include +#include +#include +#include + #include #include #include @@ -47,8 +51,9 @@ #include #include -#include -#include +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ #ifndef MAX # define MAX(a,b) ((a) > (b) ? (a) : (b)) @@ -176,7 +181,7 @@ static int rptun_thread(int argc, FAR char *argv[]) sigset_t set; int ret; - priv = (FAR struct rptun_priv_s *)atoi(argv[1]); + priv = (FAR struct rptun_priv_s *)((uintptr_t)strtoul(argv[1], NULL, 0)); sigemptyset(&set); sigaddset(&set, SIGUSR1); @@ -785,7 +790,7 @@ int rptun_initialize(FAR struct rptun_dev_s *dev) { struct metal_init_params params = METAL_INIT_DEFAULTS; FAR struct rptun_priv_s *priv; - char str[16]; + char arg1[16]; char name[16]; FAR char *argv[2]; int ret; @@ -802,10 +807,10 @@ int rptun_initialize(FAR struct rptun_dev_s *dev) return -ENOMEM; } - sprintf(name, "rptun%s", RPTUN_GET_CPUNAME(dev)); + snprintf(name, 16, "rptun%s", RPTUN_GET_CPUNAME(dev)); + snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)priv); - itoa((int)priv, str, 10); - argv[0] = str; + argv[0] = arg1; argv[1] = NULL; ret = kthread_create(name, CONFIG_RPTUN_PRIORITY, diff --git a/fs/hostfs/hostfs_rpmsg.c b/fs/hostfs/hostfs_rpmsg.c index b515ba1e394..91116e8711b 100644 --- a/fs/hostfs/hostfs_rpmsg.c +++ b/fs/hostfs/hostfs_rpmsg.c @@ -554,7 +554,7 @@ FAR void *host_opendir(FAR const char *name) ret = hostfs_rpmsg_send_recv(HOSTFS_RPMSG_OPENDIR, false, (struct hostfs_rpmsg_header_s *)msg, len, NULL); - return ret < 0 ? NULL : (FAR void *)ret; + return ret < 0 ? NULL : (FAR void *)((uintptr_t)ret); } int host_readdir(FAR void *dirp, FAR struct dirent *entry)