public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: Fix memory garbage dev_err printout.
@ 2013-02-14 12:46 Russ Dill
  2013-02-14 17:34 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Russ Dill @ 2013-02-14 12:46 UTC (permalink / raw)
  To: linux-kernel, Liam Girdwood; +Cc: Mark Brown, 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:

'[    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.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
---
 drivers/regulator/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 2785843..5a0f54a 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -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;
 	}
 
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] regulator: Fix memory garbage dev_err printout.
  2013-02-14 12:46 [PATCH] regulator: Fix memory garbage dev_err printout Russ Dill
@ 2013-02-14 17:34 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2013-02-14 17:34 UTC (permalink / raw)
  To: Russ Dill; +Cc: linux-kernel, Liam Girdwood

[-- Attachment #1: Type: text/plain, Size: 362 bytes --]

On Thu, Feb 14, 2013 at 04:46:33AM -0800, Russ Dill wrote:
> 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.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-14 17:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-14 12:46 [PATCH] regulator: Fix memory garbage dev_err printout Russ Dill
2013-02-14 17:34 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox