diff mbox

fsdev/virtfs-proxy-helper: Fix improper use of negative value

Message ID 1426468829-8024-1-git-send-email-zhaoshenglong@huawei.com
State New
Headers show

Commit Message

Shannon Zhao March 16, 2015, 1:20 a.m. UTC
It's detected by coverity. Check the return value of proxy_marshal.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 fsdev/virtfs-proxy-helper.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Aneesh Kumar K.V March 16, 2015, 6:22 a.m. UTC | #1
Shannon Zhao <zhaoshenglong@huawei.com> writes:

> It's detected by coverity. Check the return value of proxy_marshal.
>
> Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>

Applied

> ---
>  fsdev/virtfs-proxy-helper.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
> index c1da2d7..bf2e5f3 100644
> --- a/fsdev/virtfs-proxy-helper.c
> +++ b/fsdev/virtfs-proxy-helper.c
> @@ -262,6 +262,9 @@ static int send_status(int sockfd, struct iovec *iovec, int status)
>       */
>      msg_size = proxy_marshal(iovec, 0, "ddd", header.type,
>                               header.size, status);
> +    if (msg_size < 0) {
> +        return msg_size;
> +    }
>      retval = socket_write(sockfd, iovec->iov_base, msg_size);
>      if (retval < 0) {
>          return retval;
> -- 
> 1.8.3.1
diff mbox

Patch

diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
index c1da2d7..bf2e5f3 100644
--- a/fsdev/virtfs-proxy-helper.c
+++ b/fsdev/virtfs-proxy-helper.c
@@ -262,6 +262,9 @@  static int send_status(int sockfd, struct iovec *iovec, int status)
      */
     msg_size = proxy_marshal(iovec, 0, "ddd", header.type,
                              header.size, status);
+    if (msg_size < 0) {
+        return msg_size;
+    }
     retval = socket_write(sockfd, iovec->iov_base, msg_size);
     if (retval < 0) {
         return retval;