Skip to contentSkip to conversation

soc: samsung: exynos-asv: Potential NULL dereference in exynos_asv_update_opps()

PATCH Applied Dan Carpenter 2 participants 2 messages Oct 29, 2019 – Oct 30, 2019

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

PATCH 1/1 soc: samsung: exynos-asv: Potential NULL dereference in exynos_asv_update_opps()

The dev_pm_opp_get_opp_table() returns error pointers if it's disabled in the config and it returns NULL if there is an error. This code only checks for error pointers so it could lead to an Oops inside the dev_pm_opp_put_opp_table() function.

Fixes 5ea428595cc5 ("soc: samsung: Add Exynos Adaptive Supply Voltage driver")

---
When we add a new driver, could we specify the which prefix will be used going forward? In other words commit 5ea428595cc5 could have the prefix "soc: samsung: exynos-asv: Add Exynos Adaptive Supply Voltage driver". The "exynos-asv" bit was missing so the first person to send a fix has to guess what is desired.

 drivers/soc/samsung/exynos-asv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/samsung/exynos-asv.c +1 -1
index 8abf4dfaa5c5..30bb7b7cc769 100644
@@ -93,7 +93,7 @@ static int exynos_asv_update_opps(struct exynos_asv *asv)
 			continue;
 
 		opp_table = dev_pm_opp_get_opp_table(cpu);
-		if (IS_ERR(opp_table))
+		if (IS_ERR_OR_NULL(opp_table))
 			continue;
 
 		if (!last_opp_table || opp_table != last_opp_table) {
Signature · 1 line
2.20.1
maintainer Applied
#1 lore raw
Quoted 5 lines · Dan Carpenter

The dev_pm_opp_get_opp_table() returns error pointers if it's disabled in the config and it returns NULL if there is an error. This code only checks for error pointers so it could lead to an Oops inside the dev_pm_opp_put_opp_table() function.

Quoted 8 lines
Fixes 5ea428595cc5 ("soc: samsung: Add Exynos Adaptive Supply Voltage driver")

---
When we add a new driver, could we specify the which prefix will be used going forward? In other words commit 5ea428595cc5 could have the prefix "soc: samsung: exynos-asv: Add Exynos Adaptive Supply Voltage driver". The "exynos-asv" bit was missing so the first person to send a fix has to guess what is desired.

Indeed, I usually do not add it on first commit to avoid duplication (prefix and later explanation) but I see that it would be helpful.

Thanks, applied.

Best regards,
Krzysztof