Skip to contentSkip to conversation

ARM: OMAP2+: avoid NULL pointer dereference

PATCH New Nicolae Rosia 2 participants 2 messages Nov 1, 2016 – Nov 7, 2016

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

PATCH 1/1 ARM: OMAP2+: avoid NULL pointer dereference

For OMAP4, volt_data is set in omap44xx_voltagedomains_init. If the SoC is neither OMAP443X or OMAP446X, we end up with a NULL in volt_data which causes a kernel oops.
This is the case when booting OMAP4470.

---
 arch/arm/mach-omap2/voltage.c | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/mach-omap2/voltage.c +6 -0
index cba8cad..cd15dbd 100644
@@ -87,6 +87,12 @@ int voltdm_scale(struct voltagedomain *voltdm,
 		return -ENODATA;
 	}
 
+	if (!voltdm->volt_data) {
+		pr_err("%s: No voltage data defined for vdd_%s\n",
+			__func__, voltdm->name);
+		return -ENODATA;
+	}
+
 	/* Adjust voltage to the exact voltage from the OPP table */
 	for (i = 0; voltdm->volt_data[i].volt_nominal != 0; i++) {
 		if (voltdm->volt_data[i].volt_nominal >= target_volt) {
Signature · 1 line
2.5.5
maintainer
#1 lore raw

PATCH 1/1 ARM: OMAP2+: avoid NULL pointer dereference

Quoted 4 lines · Nicolae Rosia

For OMAP4, volt_data is set in omap44xx_voltagedomains_init. If the SoC is neither OMAP443X or OMAP446X, we end up with a NULL in volt_data which causes a kernel oops.
This is the case when booting OMAP4470.

Thanks applying into omap-for-v4.9/fixes.

Tony