public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Stefan Wahren <stefan.wahren@i2se.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] regulator: core: fix constraints debug output
Date: Wed, 20 May 2015 13:35:05 -0700	[thread overview]
Message-ID: <1432154105.20840.8.camel@perches.com> (raw)
In-Reply-To: <1432153029-2342-1-git-send-email-stefan.wahren@i2se.com>

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) {




  reply	other threads:[~2015-05-20 20:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-20 20:17 [PATCH] regulator: core: fix constraints debug output Stefan Wahren
2015-05-20 20:35 ` Joe Perches [this message]
2015-05-21  6:42   ` Stefan Wahren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1432154105.20840.8.camel@perches.com \
    --to=joe@perches.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=stefan.wahren@i2se.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox