staging: lustre: replace simple_strtoul with kstrtoint
PATCH v2 1/1 staging: lustre: replace simple_strtoul with kstrtoint
Replace simple_strtoul with kstrtoint.simple_strtoul is marked for obsoletion as reported by checkpatch.pl
---
v2:
-improving kstrtoint error handling
-updating commit message
drivers/staging/lustre/lustre/obdclass/obd_mount.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/obdclass/obd_mount.c +12 -4
@@ -924,12 +924,20 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd) lmd->lmd_flags |=LMD_FLG_ABORT_RECOV ; clear++; }else if (strncmp (s1,"recovery_time_soft=" ,19 ) ==0 ) { - lmd->lmd_recovery_time_soft =max_t (int, -simple_strtoul (s1 +19 ,NULL ,10 ), time_min); +int res; + + rc =kstrtoint (s1 +19 ,10 , &res); +if (rc) + goto invalid; + lmd->lmd_recovery_time_soft =max_t (int, res, time_min); clear++; }else if (strncmp (s1,"recovery_time_hard=" ,19 ) ==0 ) { - lmd->lmd_recovery_time_hard =max_t (int, -simple_strtoul (s1 +19 ,NULL ,10 ), time_min); +int res; + + rc =kstrtoint (s1 +19 ,10 , &res); +if (rc) + goto invalid; + lmd->lmd_recovery_time_hard =max_t (int, res, time_min); clear++; }else if (strncmp (s1,"noir" ,4 ) ==0 ) { lmd->lmd_flags |=LMD_FLG_NOIR ;/* test purpose only. */
Signature · 1 line
2.11.1
Greg Kroah-Hartman
maintainerQuoted 18 lines · Marcin Ciupak
Replace
simple_strtoulwith kstrtoint.simple_strtoulis marked for obsoletion as reported by checkpatch.plSigned-off-by Marcin Ciupak <[email protected]>---
v2:
-improving kstrtoint error handling
-updating commit messagedrivers/staging/lustre/lustre/obdclass/obd_mount.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)drivers/staging/lustre/lustre/obdclass/obd_mount.c +0
-0@@ -924,12 +924,20 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd) lmd->lmd_flags |=LMD_FLG_ABORT_RECOV ;
drivers/staging/lustre/lustre/obdclass/obd_mount.c static int lmd_parse(char *options, struct lustre_mount_data *lmd) · line 932
Quoted 10 lines
drivers/staging/lustre/lustre/obdclass/obd_mount.c +6
-2clear++; }else if (strncmp (s1,"recovery_time_soft=" ,19 ) ==0 ) { - lmd->lmd_recovery_time_soft =max_t (int, -simple_strtoul (s1 +19 ,NULL ,10 ), time_min); +int res; + + rc =kstrtoint (s1 +19 ,10 , &res); +if (rc) + goto invalid; + lmd->lmd_recovery_time_soft =max_t (int, res, time_min);
Are you sure max_t is still needed here?
And have you tested this change?
thanks,
greg k-h
I did test it and not everything works as expected. I need to reconsider that change. Please drop this patch.
Thanks,
Marcin
P.S. Sorry for late (sic!) response.
Quoted 37 lines · Greg Kroah-Hartman
Quoted 18 lines · Marcin Ciupak
Replace
simple_strtoulwith kstrtoint.simple_strtoulis marked for obsoletion as reported by checkpatch.plSigned-off-by Marcin Ciupak <[email protected]>---
v2:
-improving kstrtoint error handling
-updating commit messagedrivers/staging/lustre/lustre/obdclass/obd_mount.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)drivers/staging/lustre/lustre/obdclass/obd_mount.c +0
-0@@ -924,12 +924,20 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd) lmd->lmd_flags |=LMD_FLG_ABORT_RECOV ;drivers/staging/lustre/lustre/obdclass/obd_mount.c static int lmd_parse(char *options, struct lustre_mount_data *lmd) · line 932
Quoted 10 lines
drivers/staging/lustre/lustre/obdclass/obd_mount.c +6
-2clear++; }else if (strncmp (s1,"recovery_time_soft=" ,19 ) ==0 ) { - lmd->lmd_recovery_time_soft =max_t (int, -simple_strtoul (s1 +19 ,NULL ,10 ), time_min); +int res; + + rc =kstrtoint (s1 +19 ,10 , &res); +if (rc) + goto invalid; + lmd->lmd_recovery_time_soft =max_t (int, res, time_min);Are you sure
max_tis still needed here?And have you tested this change?
thanks,
greg k-h