Skip to contentSkip to conversation

s390/dasd: Fix a precision vs width bug in dasd_feature_list()

PATCH In review Dan Carpenter 2 participants 2 messages Jun 26, 2019 – Jun 27, 2019

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

PATCH 1/1 s390/dasd: Fix a precision vs width bug in dasd_feature_list()

The "len" variable is the length of the option up to the next option or to the end of the string which ever first. We want to print the invalid option so we want precision "%.*s" but the format is width "%*s" so it prints up to the end of the string.

---
Not tested.

 drivers/s390/block/dasd_devmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/block/dasd_devmap.c +1 -1
index fab35c6170cc..245f33c2f71e 100644
@@ -203,7 +203,7 @@ static int __init dasd_feature_list(char *str)
 		else if (len = 8 && !strncmp(str, "failfast", 8))
 			features |= DASD_FEATURE_FAILFAST;
 		else {
-			pr_warn("%*s is not a supported device option\n",
+			pr_warn("%.*s is not a supported device option\n",
 				len, str);
 			rc = -EINVAL;
 		}
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 8 lines · Dan Carpenter

The "len" variable is the length of the option up to the next option or to the end of the string which ever first. We want to print the invalid option so we want precision "%.*s" but the format is width "%*s" so it prints up to the end of the string.

---
Not tested.

Thanks for the patch. I tested it and it works as expected. Will integrate it through the s390 tree.