diff options
| author | Ingo Molnar <mingo@elte.hu> | 2008-07-17 17:57:20 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-07-17 17:57:20 -0400 |
| commit | 393d81aa026e19b6ede6f5f11955c97ee62e5df5 (patch) | |
| tree | a1d9511e488e19d41089ff0a736f6ce52a81c6e5 /drivers/acpi/fan.c | |
| parent | 93a0886e2368eafb9df5e2021fb185195cee88b2 (diff) | |
| parent | 5b664cb235e97afbf34db9c4d77f08ebd725335e (diff) | |
Merge branch 'linus' into xen-64bit
Diffstat (limited to 'drivers/acpi/fan.c')
| -rw-r--r-- | drivers/acpi/fan.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 6cf10cbc1eee..55c17afbe669 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
| @@ -148,7 +148,7 @@ acpi_fan_write_state(struct file *file, const char __user * buffer, | |||
| 148 | int result = 0; | 148 | int result = 0; |
| 149 | struct seq_file *m = file->private_data; | 149 | struct seq_file *m = file->private_data; |
| 150 | struct acpi_device *device = m->private; | 150 | struct acpi_device *device = m->private; |
| 151 | char state_string[12] = { '\0' }; | 151 | char state_string[3] = { '\0' }; |
| 152 | 152 | ||
| 153 | if (count > sizeof(state_string) - 1) | 153 | if (count > sizeof(state_string) - 1) |
| 154 | return -EINVAL; | 154 | return -EINVAL; |
| @@ -157,6 +157,12 @@ acpi_fan_write_state(struct file *file, const char __user * buffer, | |||
| 157 | return -EFAULT; | 157 | return -EFAULT; |
| 158 | 158 | ||
| 159 | state_string[count] = '\0'; | 159 | state_string[count] = '\0'; |
| 160 | if ((state_string[0] < '0') || (state_string[0] > '3')) | ||
| 161 | return -EINVAL; | ||
| 162 | if (state_string[1] == '\n') | ||
| 163 | state_string[1] = '\0'; | ||
| 164 | if (state_string[1] != '\0') | ||
| 165 | return -EINVAL; | ||
| 160 | 166 | ||
| 161 | result = acpi_bus_set_power(device->handle, | 167 | result = acpi_bus_set_power(device->handle, |
| 162 | simple_strtoul(state_string, NULL, 0)); | 168 | simple_strtoul(state_string, NULL, 0)); |
