Skip to content

Commit

Permalink
hwmon: (applesmc) Limit key length in warning messages
Browse files Browse the repository at this point in the history
commit ac852ed 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 <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Signed-off-by: Ben Hutchings <[email protected]>
  • Loading branch information
rydberg authored and koenkooi committed Nov 21, 2012
1 parent 396c755 commit 52bee26
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 52bee26

Please sign in to comment.