Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: Avoid NULL dereference for DRM_LEGACY debug message

smatch warns:

drivers/gpu/drm/drm_lock.c:188 drm_legacy_lock() warn:
variable dereferenced before check 'master->lock.hw_lock' (see line 177)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161127170910.29106-2-chris@chris-wilson.co.uk

authored by

Chris Wilson and committed by
Daniel Vetter
a2ec1c13 75df6247

+2 -1
+2 -1
drivers/gpu/drm/drm_lock.c
··· 176 176 177 177 DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", 178 178 lock->context, task_pid_nr(current), 179 - master->lock.hw_lock->lock, lock->flags); 179 + master->lock.hw_lock ? master->lock.hw_lock->lock : -1, 180 + lock->flags); 180 181 181 182 add_wait_queue(&master->lock.lock_queue, &entry); 182 183 spin_lock_bh(&master->lock.spinlock);