Skip to contentSkip to conversation

PM/hibernate: fix __setup handler error handling

PATCH Applied Randy Dunlap 2 participants 2 messages Feb 28, 2022 – Mar 1, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PM/hibernate: fix __setup handler error handling

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")
Link lore.kernel.org/r/[email protected]
Cc Fabian Frederick <[email protected]>
Cc Andrew Morton <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc Pavel Machek <[email protected]>
Cc Len Brown <[email protected]>
---
 kernel/power/hibernate.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/power/hibernate.c +1 -1
@@ -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;
 }
 
maintainer Applied
#1 lore raw
Quoted 23 lines · Randy Dunlap

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")
Link lore.kernel.org/r/[email protected]
Cc Fabian Frederick <[email protected]>
Cc Andrew Morton <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc Pavel Machek <[email protected]>
Cc Len Brown <[email protected]>
---
 kernel/power/hibernate.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

kernel/power/hibernate.c static int __init resumedelay_setup(char · line 1334

Quoted 7 lines
kernel/power/hibernate.c +1 -1
@@ -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!