Skip to contentSkip to conversation

intel_th: gth: Fix an off-by-one in output unassigning

PATCH New Alexander Shishkin 1 participant 1 message Mar 1, 2019

Subsystems (2)
lore
Share & tools
lore

Alexander Shishkin

author maintainer
#0 lore raw

PATCH 1/1 intel_th: gth: Fix an off-by-one in output unassigning

Commit 9ed3f22223c3 ("intel_th: Don't reference unassigned outputs") fixes a NULL dereference for all masters except the last one ("256+"), which keeps the stale pointer after the output driver had been unassigned.

Fix the off-by-one.

Fixes 9ed3f22223c3 ("intel_th: Don't reference unassigned outputs")
---
 drivers/hwtracing/intel_th/gth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwtracing/intel_th/gth.c +1 -1
index cc287cf6eb29..edc52d75e6bd 100644
@@ -616,7 +616,7 @@ static void intel_th_gth_unassign(struct intel_th_device *thdev,
 	othdev->output.port = -1;
 	othdev->output.active = false;
 	gth->output[port].output = NULL;
-	for (master = 0; master < TH_CONFIGURABLE_MASTERS; master++)
+	for (master = 0; master <= TH_CONFIGURABLE_MASTERS; master++)
 		if (gth->master[master] == port)
 			gth->master[master] = -1;
 	spin_unlock(&gth->gth_lock);
Signature · 1 line
2.20.1