diff options
Diffstat (limited to 'arch/s390/kernel')
-rw-r--r-- | arch/s390/kernel/ipl.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c index 04451a5e3c15..ee57a42e6e93 100644 --- a/arch/s390/kernel/ipl.c +++ b/arch/s390/kernel/ipl.c | |||
@@ -340,19 +340,28 @@ size_t reipl_append_ascii_scpdata(char *dest, size_t size, | |||
340 | { | 340 | { |
341 | size_t count; | 341 | size_t count; |
342 | size_t i; | 342 | size_t i; |
343 | int has_lowercase; | ||
343 | 344 | ||
344 | count = min(size - 1, scpdata_length(ipb->ipl_info.fcp.scp_data, | 345 | count = min(size - 1, scpdata_length(ipb->ipl_info.fcp.scp_data, |
345 | ipb->ipl_info.fcp.scp_data_len)); | 346 | ipb->ipl_info.fcp.scp_data_len)); |
346 | if (!count) | 347 | if (!count) |
347 | goto out; | 348 | goto out; |
348 | 349 | ||
349 | for (i = 0; i < count; i++) | 350 | has_lowercase = 0; |
351 | for (i = 0; i < count; i++) { | ||
350 | if (!isascii(ipb->ipl_info.fcp.scp_data[i])) { | 352 | if (!isascii(ipb->ipl_info.fcp.scp_data[i])) { |
351 | count = 0; | 353 | count = 0; |
352 | goto out; | 354 | goto out; |
353 | } | 355 | } |
356 | if (!has_lowercase && islower(ipb->ipl_info.fcp.scp_data[i])) | ||
357 | has_lowercase = 1; | ||
358 | } | ||
354 | 359 | ||
355 | memcpy(dest, ipb->ipl_info.fcp.scp_data, count); | 360 | if (has_lowercase) |
361 | memcpy(dest, ipb->ipl_info.fcp.scp_data, count); | ||
362 | else | ||
363 | for (i = 0; i < count; i++) | ||
364 | dest[i] = tolower(ipb->ipl_info.fcp.scp_data[i]); | ||
356 | out: | 365 | out: |
357 | dest[count] = '\0'; | 366 | dest[count] = '\0'; |
358 | return count; | 367 | return count; |