diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/power/disk.c | 3 | ||||
-rw-r--r-- | kernel/power/main.c | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index b5f0543ed84d..f445b9cd60fb 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
@@ -416,7 +416,8 @@ static ssize_t disk_store(struct kset *kset, const char *buf, size_t n) | |||
416 | 416 | ||
417 | mutex_lock(&pm_mutex); | 417 | mutex_lock(&pm_mutex); |
418 | for (i = HIBERNATION_FIRST; i <= HIBERNATION_MAX; i++) { | 418 | for (i = HIBERNATION_FIRST; i <= HIBERNATION_MAX; i++) { |
419 | if (!strncmp(buf, hibernation_modes[i], len)) { | 419 | if (len == strlen(hibernation_modes[i]) |
420 | && !strncmp(buf, hibernation_modes[i], len)) { | ||
420 | mode = i; | 421 | mode = i; |
421 | break; | 422 | break; |
422 | } | 423 | } |
diff --git a/kernel/power/main.c b/kernel/power/main.c index b98b80ccf437..8812985f3029 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -290,13 +290,13 @@ static ssize_t state_store(struct kset *kset, const char *buf, size_t n) | |||
290 | len = p ? p - buf : n; | 290 | len = p ? p - buf : n; |
291 | 291 | ||
292 | /* First, check if we are requested to hibernate */ | 292 | /* First, check if we are requested to hibernate */ |
293 | if (!strncmp(buf, "disk", len)) { | 293 | if (len == 4 && !strncmp(buf, "disk", len)) { |
294 | error = hibernate(); | 294 | error = hibernate(); |
295 | return error ? error : n; | 295 | return error ? error : n; |
296 | } | 296 | } |
297 | 297 | ||
298 | for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++) { | 298 | for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++) { |
299 | if (*s && !strncmp(buf, *s, len)) | 299 | if (*s && len == strlen(*s) && !strncmp(buf, *s, len)) |
300 | break; | 300 | break; |
301 | } | 301 | } |
302 | if (state < PM_SUSPEND_MAX && *s) | 302 | if (state < PM_SUSPEND_MAX && *s) |