Skip to contentSkip to conversation

drm: potential NULL dereference with debugging enabled

PATCH New Dan Carpenter 1 participant 1 message Oct 26, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: potential NULL dereference with debugging enabled

We check whether this pointer is NULL a few lines later in the function so probably we should check here too.

---
This is a static checker fix.

drivers/gpu/drm/drm_lock.c +2 -1
index d752c96..036253e 100644
@@ -68,7 +68,8 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
 
 	DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
 		  lock->context, task_pid_nr(current),
-		  master->lock.hw_lock->lock, lock->flags);
+		  master->lock.hw_lock ? master->lock.hw_lock->lock : -1,
+		  lock->flags);
 
 	add_wait_queue(&master->lock.lock_queue, &entry);
 	spin_lock_bh(&master->lock.spinlock);