Skip to contentSkip to conversation

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

PATCH Applied Shannon Zhao 2 participants 2 messages Mar 16, 2015

lore
Share & tools
lore
#0 lore raw

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

It's detected by coverity. Check the return value of proxy_marshal.

---
 fsdev/virtfs-proxy-helper.c | 3 +++
 1 file changed, 3 insertions(+)
fsdev/virtfs-proxy-helper.c +3 -0
index c1da2d7..bf2e5f3 100644
@@ -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;
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 4 lines · Shannon Zhao

It's detected by coverity. Check the return value of proxy_marshal.

Applied

Quoted 20 lines
---
 fsdev/virtfs-proxy-helper.c | 3 +++
 1 file changed, 3 insertions(+)
fsdev/virtfs-proxy-helper.c +3 -0
index c1da2d7..bf2e5f3 100644
@@ -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;
Signature · 1 line
1.8.3.1