drm/vmwgfx: Add a check to handle host message failure
authorSinclair Yeh <syeh@vmware.com>
Wed, 29 Jun 2016 23:31:01 +0000 (16:31 -0700)
committerSinclair Yeh <syeh@vmware.com>
Fri, 1 Jul 2016 17:47:47 +0000 (10:47 -0700)
Discovered by static code analysis tool.  If for some reason communication
with the host fails more than preset number of retries, return an error
instead of return garbage.

Signed-off-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
drivers/gpu/drm/vmwgfx/vmwgfx_msg.c

index f0374f9b56cad3a522119f7d4cf8a8940f445bf0..e57a0bad7a626daf505625ce019f2583218a51ab 100644 (file)
@@ -300,6 +300,9 @@ static int vmw_recv_msg(struct rpc_channel *channel, void **msg,
                break;
        }
 
+       if (retries == RETRIES)
+               return -EINVAL;
+
        *msg_len = reply_len;
        *msg     = reply;