Skip to contentSkip to conversation

regulator: Fix memory garbage dev_err printout.

PATCH Applied Russ Dill 2 participants 2 messages Feb 14, 2013 Voltage and current regulator framework

lore
Share & tools
lore

Russ Dill

author
#0 lore raw

PATCH 1/1 regulator: Fix memory garbage dev_err printout.

commit dd8004af: 'regulator: core: Log when a device causes a voltage constraint fail', tried to print out some information about the check consumer min/max uV fixup, however, it uses a garbage pointer left over from list_for_each_entry leading to boot messages in the form:

'[ 2.079890] <RANDOM ASCII>: Restricting voltage, 3735899821-4294967295uV'

Because it references regulator->dev, it could potentially read memory from anywhere causing a panic.

This patch instead uses rdev and the updated min/max uV values.

---
 drivers/regulator/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/regulator/core.c +2 -2
index 2785843..5a0f54a 100644
@@ -200,8 +200,8 @@ static int regulator_check_consumers(struct regulator_dev *rdev,
 	}
 
 	if (*min_uV > *max_uV) {
-		dev_err(regulator->dev, "Restricting voltage, %u-%uuV\n",
-			regulator->min_uV, regulator->max_uV);
+		rdev_err(rdev, "Restricting voltage, %u-%uuV\n",
+			*min_uV, *max_uV);
 		return -EINVAL;
 	}
 
Signature · 1 line
1.8.1.2
Applied
#1 lore raw
Quoted 5 lines · Russ Dill

commit dd8004af: 'regulator: core: Log when a device causes a voltage constraint fail', tried to print out some information about the check consumer min/max uV fixup, however, it uses a garbage pointer left over from list_for_each_entry leading to boot messages in the form:

Applied, thanks.