summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2012-06-07 04:54:29 -0400
committerGuenter Roeck <linux@roeck-us.net>2012-06-18 08:48:00 -0700
commitac852edb47b15900886ba2564eeeb13b3b526e3e (patch)
tree90cb765f808e48f7b956a0e979b99b0c4f44e3b3
parent485802a6c524e62b5924849dd727ddbb1497cc71 (diff)
downloadlinux-ac852edb47b15900886ba2564eeeb13b3b526e3e.tar.gz
linux-ac852edb47b15900886ba2564eeeb13b3b526e3e.tar.bz2
linux-ac852edb47b15900886ba2564eeeb13b3b526e3e.zip
hwmon: (applesmc) Limit key length in warning messages
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> Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--drivers/hwmon/applesmc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index f082e48ab113..70d62f5bc909 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);