Skip to content

Commit

Permalink
PM / hibernate: Fix memory corruption in resumedelay_setup()
Browse files Browse the repository at this point in the history
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: 317cf7e (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>
  • Loading branch information
Dan Carpenter authored and Rafael J. Wysocki committed May 16, 2014
1 parent 317cf7e commit f6514be
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/power/hibernate.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
static int nocompress;
static int noresume;
static int resume_wait;
static int resume_delay;
static unsigned int resume_delay;
static char resume_file[256] = CONFIG_PM_STD_PARTITION;
dev_t swsusp_resume_device;
sector_t swsusp_resume_block;
Expand Down Expand Up @@ -1115,7 +1115,7 @@ static int __init resumewait_setup(char *str)

static int __init resumedelay_setup(char *str)
{
int rc = kstrtoul(str, 0, (unsigned long *)&resume_delay);
int rc = kstrtouint(str, 0, &resume_delay);

if (rc)
return rc;
Expand Down

0 comments on commit f6514be

Please sign in to comment.