Skip to content

Commit

Permalink
SUNRPC: fix uninitialized variable warning
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
  • Loading branch information
alakesh authored and Trond Myklebust committed Mar 26, 2019
1 parent 166bd5b commit 01f2f5b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/sunrpc/xprtsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 01f2f5b

Please sign in to comment.