From 5f60b7dc12fdeca403ec0a402288aa594e3eecfb Mon Sep 17 00:00:00 2001 From: ligd Date: Thu, 19 May 2022 12:15:24 +0800 Subject: [PATCH] rpmsgfs: hande count <=0 when rpmsgfs_read&write Signed-off-by: ligd --- fs/rpmsgfs/rpmsgfs_client.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/rpmsgfs/rpmsgfs_client.c b/fs/rpmsgfs/rpmsgfs_client.c index c79586cab6..48d17e49d1 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);