All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i915-pmu: Add extra check engine
@ 2022-08-16 12:38 ` Denis Arefev
  0 siblings, 0 replies; 6+ messages in thread
From: Denis Arefev @ 2022-08-16 12:38 UTC (permalink / raw)
  To: Jani Nikula
  Cc: Joonas Lahtinen, Rodrigo Vivi, David Airlie, Daniel Vetter,
	intel-gfx, dri-devel, linux-kernel, ldv-project

Return value of a function 'intel_engine_lookup_user' is dereferenced at i915_pmu.c:708
without checking for null, but it is usually checked for this function

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
 drivers/gpu/drm/i915/i915_pmu.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
index 69c0fa20eba1..33db49ffac3d 100644
--- a/drivers/gpu/drm/i915/i915_pmu.c
+++ b/drivers/gpu/drm/i915/i915_pmu.c
@@ -704,8 +704,10 @@ static void i915_pmu_disable(struct perf_event *event)
 		 * Decrement the reference count and clear the enabled
 		 * bitmask when the last listener on an event goes away.
 		 */
-		if (--engine->pmu.enable_count[sample] == 0)
-			engine->pmu.enable &= ~BIT(sample);
+		if (engine != NULL) {
+		        if (--engine->pmu.enable_count[sample] == 0)
+			        engine->pmu.enable &= ~BIT(sample);
+		}
 	}
 
 	GEM_BUG_ON(bit >= ARRAY_SIZE(pmu->enable_count));
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-08-17  7:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-16 12:38 [PATCH] i915-pmu: Add extra check engine Denis Arefev
2022-08-16 12:38 ` Denis Arefev
2022-08-16 12:38 ` [Intel-gfx] " Denis Arefev
2022-08-16 14:21 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2022-08-16 14:43 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-08-16 16:31 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.