Skip to content

Commit

Permalink
hwmon: (applesmc) Limit key length in warning messages
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Henrik Rydberg authored and Guenter Roeck committed Jun 18, 2012
1 parent 485802a commit ac852ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/hwmon/applesmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,15 @@ 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;
}

outb(len, APPLESMC_DATA_PORT);

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);
Expand Down

0 comments on commit ac852ed

Please sign in to comment.