diff mbox series

PM/hibernate: fix __setup handler error handling

Message ID 20220228220532.8531-1-rdunlap@infradead.org
State New
Headers show
Series PM/hibernate: fix __setup handler error handling | expand

Commit Message

Randy Dunlap Feb. 28, 2022, 10:05 p.m. UTC
If an invalid value is used in "resumedelay=<seconds>", it is
silently ignored. Add a warning message and then let the __setup
handler return 1 to indicate that the kernel command line option
has been handled.

Fixes: 317cf7e5e85e3 ("PM / hibernate: convert simple_strtoul to kstrtoul")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
Cc: Fabian Frederick <fabf@skynet.be>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: linux-pm@vger.kernel.org
Cc: Len Brown <len.brown@intel.com>
---
 kernel/power/hibernate.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rafael J. Wysocki March 1, 2022, 5:51 p.m. UTC | #1
On Mon, Feb 28, 2022 at 11:05 PM Randy Dunlap <rdunlap@infradead.org> wrote:
>
> If an invalid value is used in "resumedelay=<seconds>", it is
> silently ignored. Add a warning message and then let the __setup
> handler return 1 to indicate that the kernel command line option
> has been handled.
>
> Fixes: 317cf7e5e85e3 ("PM / hibernate: convert simple_strtoul to kstrtoul")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
> Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
> Cc: Fabian Frederick <fabf@skynet.be>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Cc: Pavel Machek <pavel@ucw.cz>
> Cc: linux-pm@vger.kernel.org
> Cc: Len Brown <len.brown@intel.com>
> ---
>  kernel/power/hibernate.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- linux-next-20220228.orig/kernel/power/hibernate.c
> +++ linux-next-20220228/kernel/power/hibernate.c
> @@ -1329,7 +1329,7 @@ static int __init resumedelay_setup(char
>         int rc = kstrtouint(str, 0, &resume_delay);
>
>         if (rc)
> -               return rc;
> +               pr_warn("resumedelay: bad option string '%s'\n", str);
>         return 1;
>  }

Applied as 5.18 material, thanks!
diff mbox series

Patch

--- linux-next-20220228.orig/kernel/power/hibernate.c
+++ linux-next-20220228/kernel/power/hibernate.c
@@ -1329,7 +1329,7 @@  static int __init resumedelay_setup(char
 	int rc = kstrtouint(str, 0, &resume_delay);
 
 	if (rc)
-		return rc;
+		pr_warn("resumedelay: bad option string '%s'\n", str);
 	return 1;
 }