From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933380AbbFISzT (ORCPT ); Tue, 9 Jun 2015 14:55:19 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:50724 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933284AbbFISy4 (ORCPT ); Tue, 9 Jun 2015 14:54:56 -0400 From: Mark Brown To: linux-kernel@vger.kernel.org Cc: Stefan Wahren , Mark Brown Date: Tue, 9 Jun 2015 19:54:43 +0100 Message-Id: <1433876083-30046-1-git-send-email-broonie@kernel.org> X-Mailer: git-send-email 2.1.4 X-SA-Exim-Connect-IP: 94.175.94.161 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: [PATCH] regulator: core: Don't corrupt display when printing uV offsets X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We weren't taking into account the already used buffer when telling sprintf() where to print to. Reported-by: Stefan Wahren Signed-off-by: Mark Brown --- drivers/regulator/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index f6989485c382..5ec894e9f3e4 100644 --- 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) { -- 2.1.4