diff --git a/fs/rpmsgfs/rpmsgfs_client.c b/fs/rpmsgfs/rpmsgfs_client.c index c79586cab6b..48d17e49d17 100644 --- a/fs/rpmsgfs/rpmsgfs_client.c +++ b/fs/rpmsgfs/rpmsgfs_client.c @@ -451,6 +451,11 @@ ssize_t rpmsgfs_client_read(FAR void *handle, int fd, struct rpmsgfs_read_s msg; int ret = 0; + if (!buf || count <= 0) + { + return 0; + } + memset(&cookie, 0, sizeof(cookie)); nxsem_init(&cookie.sem, 0, 0); @@ -490,6 +495,11 @@ ssize_t rpmsgfs_client_write(FAR void *handle, int fd, size_t written = 0; int ret = 0; + if (!buf || count <= 0) + { + return 0; + } + memset(&cookie, 0, sizeof(cookie)); nxsem_init(&cookie.sem, 0, 0); nxsem_set_protocol(&cookie.sem, SEM_PRIO_NONE);