lkml.org 
[lkml]   [2016]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/1] drm/vmwgfx: avoid possible NULL pointer dereference
Date
The comment describing function vmw_cmd_res_reloc_add
explicitely mentions p_val may be NULL.

We should not assign a value (NULL) to *p_val in this case.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index dc5beff..0363989 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -652,7 +652,11 @@ static int vmw_cmd_res_reloc_add(struct vmw_private *dev_priv,
int ret;
struct vmw_resource_val_node *node;

+ if (!p_val)
+ return;
+
*p_val = NULL;
+
ret = vmw_resource_relocation_add(&sw_context->res_relocations,
res,
id_loc - sw_context->buf_start);
@@ -663,8 +667,7 @@ static int vmw_cmd_res_reloc_add(struct vmw_private *dev_priv,
if (unlikely(ret != 0))
return ret;

- if (p_val)
- *p_val = node;
+ *p_val = node;

return 0;
}
--
2.1.4
\
 
 \ /
  Last update: 2016-09-17 09:57    [W:0.053 / U:0.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site