]> git.baikalelectronics.ru Git - kernel.git/commitdiff
SUNRPC: fix uninitialized variable warning
authorAlakesh Haloi <alakesh.haloi@gmail.com>
Tue, 26 Mar 2019 02:00:01 +0000 (02:00 +0000)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Tue, 26 Mar 2019 20:04:32 +0000 (13:04 -0700)
Avoid following compiler warning on uninitialized variable

net/sunrpc/xprtsock.c: In function ‘xs_read_stream_request.constprop’:
net/sunrpc/xprtsock.c:525:10: warning: ‘read’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   return read;
          ^~~~
net/sunrpc/xprtsock.c:529:23: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  return ret < 0 ? ret : read;
         ~~~~~~~~~~~~~~^~~~~~

Signed-off-by: Alakesh Haloi <alakesh.haloi@gmail.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
net/sunrpc/xprtsock.c

index 9359539907bafb7ca1c13ad51485756ac89ce5d0..732d4b57411a2562ad8dc4ee2633c8441f204ba0 100644 (file)
@@ -495,8 +495,8 @@ xs_read_stream_request(struct sock_xprt *transport, struct msghdr *msg,
                int flags, struct rpc_rqst *req)
 {
        struct xdr_buf *buf = &req->rq_private_buf;
-       size_t want, read;
-       ssize_t ret;
+       size_t want, uninitialized_var(read);
+       ssize_t uninitialized_var(ret);
 
        xs_read_header(transport, buf);