diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2014-05-14 12:08:46 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-05-16 17:15:05 -0400 |
commit | f6514be5fe7fe796041b673bad769510414ff2b9 (patch) | |
tree | c2d0104c293a571916d6f4a7844096aa287993a6 /kernel | |
parent | 317cf7e5e85e3ef9f23fc6dd8b2945ab4a258140 (diff) |
PM / hibernate: Fix memory corruption in resumedelay_setup()
In the original code "resume_delay" is an int so on 64 bits, the call to
kstrtoul() will cause memory corruption. We may as well fix a style
issue here as well and make "resume_delay" unsigned int, since that's
what we pass to ssleep().
Fixes: 317cf7e5e85e (PM / hibernate: convert simple_strtoul to kstrtoul)
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/power/hibernate.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index 2377ff72994c..df88d55dc436 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
@@ -35,7 +35,7 @@ | |||
35 | static int nocompress; | 35 | static int nocompress; |
36 | static int noresume; | 36 | static int noresume; |
37 | static int resume_wait; | 37 | static int resume_wait; |
38 | static int resume_delay; | 38 | static unsigned int resume_delay; |
39 | static char resume_file[256] = CONFIG_PM_STD_PARTITION; | 39 | static char resume_file[256] = CONFIG_PM_STD_PARTITION; |
40 | dev_t swsusp_resume_device; | 40 | dev_t swsusp_resume_device; |
41 | sector_t swsusp_resume_block; | 41 | sector_t swsusp_resume_block; |
@@ -1115,7 +1115,7 @@ static int __init resumewait_setup(char *str) | |||
1115 | 1115 | ||
1116 | static int __init resumedelay_setup(char *str) | 1116 | static int __init resumedelay_setup(char *str) |
1117 | { | 1117 | { |
1118 | int rc = kstrtoul(str, 0, (unsigned long *)&resume_delay); | 1118 | int rc = kstrtouint(str, 0, &resume_delay); |
1119 | 1119 | ||
1120 | if (rc) | 1120 | if (rc) |
1121 | return rc; | 1121 | return rc; |