public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwmon: (applesmc) Limit key length in warning messages
@ 2012-06-07  8:54 Henrik Rydberg
  2012-06-07 13:38 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Henrik Rydberg @ 2012-06-07  8:54 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Jean Delvare, lm-sensors, linux-kernel, Henrik Rydberg

Key lookups may call read_smc() with a fixed-length key string,
and if the lookup fails, trailing stack content may appear in the
kernel log. Fixed with this patch.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
---
 drivers/hwmon/applesmc.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index f082e48..70d62f5 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -215,7 +215,7 @@ static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len)
 	int i;
 
 	if (send_command(cmd) || send_argument(key)) {
-		pr_warn("%s: read arg fail\n", key);
+		pr_warn("%.4s: read arg fail\n", key);
 		return -EIO;
 	}
 
@@ -223,7 +223,7 @@ static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len)
 
 	for (i = 0; i < len; i++) {
 		if (__wait_status(0x05)) {
-			pr_warn("%s: read data fail\n", key);
+			pr_warn("%.4s: read data fail\n", key);
 			return -EIO;
 		}
 		buffer[i] = inb(APPLESMC_DATA_PORT);
-- 
1.7.10.3


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

* Re: [PATCH] hwmon: (applesmc) Limit key length in warning messages
  2012-06-07  8:54 [PATCH] hwmon: (applesmc) Limit key length in warning messages Henrik Rydberg
@ 2012-06-07 13:38 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2012-06-07 13:38 UTC (permalink / raw)
  To: Henrik Rydberg
  Cc: Jean Delvare, lm-sensors@lm-sensors.org,
	linux-kernel@vger.kernel.org

On Thu, Jun 07, 2012 at 04:54:29AM -0400, Henrik Rydberg wrote:
> Key lookups may call read_smc() with a fixed-length key string,
> and if the lookup fails, trailing stack content may appear in the
> kernel log. Fixed with this patch.
> 
> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>

Applied.

Thanks,
Guenter

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

end of thread, other threads:[~2012-06-07 13:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-07  8:54 [PATCH] hwmon: (applesmc) Limit key length in warning messages Henrik Rydberg
2012-06-07 13:38 ` Guenter Roeck

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