From: Sinclair Yeh Date: Wed, 29 Jun 2016 23:31:01 +0000 (-0700) Subject: drm/vmwgfx: Add a check to handle host message failure X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a9cd9c044aa90ba2b31d1bf3e3432f38fb1d25fe;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/vmwgfx: Add a check to handle host message failure 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 Reviewed-by: Charmaine Lee Reported-by: Dan Carpenter --- diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c index f0374f9b56ca..e57a0bad7a62 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c @@ -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;