diff --git a/fs/hmdfs/comm/socket_adapter.c b/fs/hmdfs/comm/socket_adapter.c index e6b340b4ee72ac35592f8a67e323696218b8b312..54feb31e811dbe5628b52eb85dd74fc04dda4cd5 100644 --- a/fs/hmdfs/comm/socket_adapter.c +++ b/fs/hmdfs/comm/socket_adapter.c @@ -878,6 +878,11 @@ static int hmdfs_readfile_slice(struct sendmsg_wait_queue *msg_info, loff_t offset; ssize_t written_size; + if (filp == NULL) { + hmdfs_warning("recv_info filp is NULL \n"); + return -EINVAL; + } + if (atomic_read(&recv_info->state) != FILE_RECV_PROCESS) return -EBUSY; diff --git a/fs/hmdfs/hmdfs_server.c b/fs/hmdfs/hmdfs_server.c index ae4a941a4d71f4cec084f98f589dcb44a8346fec..d09b4b6ced2b1d300bae5827d05fc302462b6484 100644 --- a/fs/hmdfs/hmdfs_server.c +++ b/fs/hmdfs/hmdfs_server.c @@ -37,7 +37,7 @@ static void find_first_no_slash(const char **name, int *len) const char *s = *name; int l = *len; - while (*s == '/' && l > 0) { + while (l > 0 && *s == '/') { s++; l--; } @@ -51,7 +51,7 @@ static void find_first_slash(const char **name, int *len) const char *s = *name; int l = *len; - while (*s != '/' && l > 0) { + while (l > 0 && *s != '/') { s++; l--; }