Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 005b2d46 authored by Samantha Tran's avatar Samantha Tran
Browse files

disp: msm: sde: add proper null checks



This change adds proper null checks after using
kcalloc and returns early to avoid accessing null ptr.

Change-Id: I948ad37eb120e00c5f6e3ae2e3b967819cbd233b
Signed-off-by: default avatarSamantha Tran <samtran@codeaurora.org>
parent 2eeed8c7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -470,6 +470,10 @@ void sde_core_irq_preinstall(struct sde_kms *sde_kms)
			sizeof(atomic_t), GFP_KERNEL);
	sde_kms->irq_obj.irq_counts = kcalloc(sde_kms->irq_obj.total_irqs,
			sizeof(atomic_t), GFP_KERNEL);
	if (!sde_kms->irq_obj.irq_cb_tbl || !sde_kms->irq_obj.enable_counts
			|| !sde_kms->irq_obj.irq_counts)
		return;

	for (i = 0; i < sde_kms->irq_obj.total_irqs; i++) {
		INIT_LIST_HEAD(&sde_kms->irq_obj.irq_cb_tbl[i]);
		atomic_set(&sde_kms->irq_obj.enable_counts[i], 0);