diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2016-05-18 20:17:19 (GMT) |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-05-23 12:56:11 (GMT) |
commit | b80d3942329dcd43580adc3f7c0a098515b5feec (patch) | |
tree | 59cf8fec7c96db9ff43ad3eeec930a68ec5dbf31 /drivers | |
parent | d28ab95b3cdc502b103bb78fa5f07cb88dbf1161 (diff) | |
download | linux-b80d3942329dcd43580adc3f7c0a098515b5feec.tar.xz |
drm/mm: avoid possible null pointer dereference
Do not dereference node before the check if node is NULL.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1463602639-4861-1-git-send-email-xypron.glpk@gmx.de
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/drm_mm.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c index 04de6fd..cb39f45 100644 --- a/drivers/gpu/drm/drm_mm.c +++ b/drivers/gpu/drm/drm_mm.c @@ -179,12 +179,14 @@ static void drm_mm_insert_helper(struct drm_mm_node *hole_node, int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node) { struct drm_mm_node *hole; - u64 end = node->start + node->size; + u64 end; u64 hole_start; u64 hole_end; BUG_ON(node == NULL); + end = node->start + node->size; + /* Find the relevant hole to add our node to */ drm_mm_for_each_hole(hole, mm, hole_start, hole_end) { if (hole_start > node->start || hole_end < end) |