From: Pavel Machek <pavel@ucw.cz>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Fabian Frederick <fabf@skynet.be>,
Len Brown <len.brown@intel.com>,
linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] PM / hibernate: memory corruption in resumedelay_setup()
Date: Wed, 14 May 2014 15:56:02 +0000 [thread overview]
Message-ID: <20140514155602.GA9723@amd.pavel.ucw.cz> (raw)
In-Reply-To: <20140514125720.GC14571@mwanda>
Hi!
> "resume_delay" is not an unsigned long, it's an int, so this will
> corrupt memory on 64 bit systems.
ssleep takes unsigned int.
Variable is int.
We parse it using kstrtoul.
So I'd suggest: switch resume_delay variable to unsigned int, and use
kstrtouint().
> Fixes: 317cf7e5e85e ('PM / hibernate: convert simple_strtoul to kstrtoul')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
> index 2377ff7..3659b26 100644
> --- a/kernel/power/hibernate.c
> +++ b/kernel/power/hibernate.c
> @@ -1115,8 +1115,9 @@ 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;
>
> + rc = kstrtoint(str, 0, &resume_delay);
...and if possible, keep it on one line.
Thanks,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
next prev parent reply other threads:[~2014-05-14 15:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-14 12:57 [patch] PM / hibernate: memory corruption in resumedelay_setup() Dan Carpenter
2014-05-14 15:56 ` Pavel Machek [this message]
2014-05-14 16:08 ` [patch v2] " Dan Carpenter
2014-05-14 20:29 ` Pavel Machek
2014-05-19 23:23 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140514155602.GA9723@amd.pavel.ucw.cz \
--to=pavel@ucw.cz \
--cc=dan.carpenter@oracle.com \
--cc=fabf@skynet.be \
--cc=kernel-janitors@vger.kernel.org \
--cc=len.brown@intel.com \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox