lkml.org 
[lkml]   [2015]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] regulator: core: fix constraints debug output
From
Date
On Wed, 2015-05-20 at 20:17 +0000, Stefan Wahren wrote:
> In the case uV_offset is greater than 0 the debug output before
> is accidentally overwritten. So take care of the output count.

If you are going to take care, please change all of these
sprintf calls to snprintf.

The buf array may not be big enough [80] to hold the longest
possible output string.

> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
[]
> @@ -801,7 +801,7 @@ static void print_constraints(struct regulator_dev *rdev)
> }
>
> if (constraints->uV_offset)
> - count += sprintf(buf, "%dmV offset ",
> + count += sprintf(buf + count, "%dmV offset ",
> constraints->uV_offset / 1000);
>
> if (constraints->min_uA && constraints->max_uA) {





\
 
 \ /
  Last update: 2015-05-20 22:41    [W:0.050 / U:1.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site