]> git.proxmox.com Git - mirror_ubuntu-disco-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)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 2 Jul 2019 10:07:53 +0000 (12:07 +0200)
BugLink: https://bugs.launchpad.net/bugs/1830934
[ Upstream commit 01f2f5b82a2b523ae76af53f2ff43c48dde10a00 ]

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>
Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel.org>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
net/sunrpc/xprtsock.c

index 7754aa3e434f405711cfce8d9bdfece972dfc75c..f88c2bd1335a70be122a9d7561e86a9d9fd0b095 100644 (file)
@@ -486,8 +486,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);