Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 101985
b: refs/heads/master
c: 6594d87
h: refs/heads/master
i:
  101983: 85851dc
v: v3
  • Loading branch information
Yi Yang authored and Andi Kleen committed Jul 16, 2008
1 parent e32c642 commit 5bfdf5d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 74523c901342a773ddd9f14c14539ec3d4197ecf
refs/heads/master: 6594d87ebd8371f4b67f7ab4b68f172b139b78d6
8 changes: 7 additions & 1 deletion trunk/drivers/acpi/fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ acpi_fan_write_state(struct file *file, const char __user * buffer,
int result = 0;
struct seq_file *m = file->private_data;
struct acpi_device *device = m->private;
char state_string[12] = { '\0' };
char state_string[3] = { '\0' };

if (count > sizeof(state_string) - 1)
return -EINVAL;
Expand All @@ -157,6 +157,12 @@ acpi_fan_write_state(struct file *file, const char __user * buffer,
return -EFAULT;

state_string[count] = '\0';
if ((state_string[0] < '0') || (state_string[0] > '3'))
return -EINVAL;
if (state_string[1] == '\n')
state_string[1] = '\0';
if (state_string[1] != '\0')
return -EINVAL;

result = acpi_bus_set_power(device->handle,
simple_strtoul(state_string, NULL, 0));
Expand Down

0 comments on commit 5bfdf5d

Please sign in to comment.