diff options
author | Henrik Rydberg <rydberg@euromail.se> | 2012-06-07 04:54:29 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-16 11:47:38 -0400 |
commit | cd2ae436c3ef59659ba10754213c8614d256dc86 (patch) | |
tree | d68e8c422e27238b85f5e5743bb422384af48098 | |
parent | c5a07578befc10cde568f54a2103ad4273ef98c1 (diff) |
hwmon: (applesmc) Limit key length in warning messages
commit ac852edb47b15900886ba2564eeeb13b3b526e3e upstream.
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>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/hwmon/applesmc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index 4c0743660e9..d99aa848477 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) | |||
215 | int i; | 215 | int i; |
216 | 216 | ||
217 | if (send_command(cmd) || send_argument(key)) { | 217 | if (send_command(cmd) || send_argument(key)) { |
218 | pr_warn("%s: read arg fail\n", key); | 218 | pr_warn("%.4s: read arg fail\n", key); |
219 | return -EIO; | 219 | return -EIO; |
220 | } | 220 | } |
221 | 221 | ||
@@ -223,7 +223,7 @@ static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len) | |||
223 | 223 | ||
224 | for (i = 0; i < len; i++) { | 224 | for (i = 0; i < len; i++) { |
225 | if (__wait_status(0x05)) { | 225 | if (__wait_status(0x05)) { |
226 | pr_warn("%s: read data fail\n", key); | 226 | pr_warn("%.4s: read data fail\n", key); |
227 | return -EIO; | 227 | return -EIO; |
228 | } | 228 | } |
229 | buffer[i] = inb(APPLESMC_DATA_PORT); | 229 | buffer[i] = inb(APPLESMC_DATA_PORT); |