]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
hwmon: (applesmc) Limit key length in warning messages
authorHenrik Rydberg <rydberg@euromail.se>
Thu, 7 Jun 2012 08:54:29 +0000 (04:54 -0400)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 4 Jul 2012 04:44:08 +0000 (05:44 +0100)
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: Ben Hutchings <ben@decadent.org.uk>
drivers/hwmon/applesmc.c

index 4c0743660e9c7684c12184b9824c94ffe655f4eb..d99aa8484777fc76d787c441951c82b20b75a73e 100644 (file)
@@ -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);