Skip to contentSkip to conversation

drm/vc4: allocate enough memory in vc4_save_hang_state()

PATCH In review Dan Carpenter 1 participant 1 message Dec 17, 2015

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

PATCH 2/3 drm/vc4: allocate enough memory in vc4_save_hang_state()

"state" is smaller than "kernel_state" so we end up corrupting memory.

Fixes 214613656b51 ('drm/vc4: Add an interface for capturing the GPU state after a hang.')
drivers/gpu/drm/vc4/vc4_gem.c +1 -1
index 461a16c..2a680d9 100644
@@ -145,7 +145,7 @@ vc4_save_hang_state(struct drm_device *dev)
 	unsigned long irqflags;
 	unsigned int i, unref_list_count;
 
-	kernel_state = kcalloc(1, sizeof(*state), GFP_KERNEL);
+	kernel_state = kcalloc(1, sizeof(*kernel_state), GFP_KERNEL);
 	if (!kernel_state)
 		return;