rocm_smi.py: Handle corrupted serial number
If the FRU has been corrupted, then the serial number will come in with any manner of random bytes, which will cause decode() to fail spectacularily. Check that the serial returned by the kernel is alphanumeric, and print to the error log if not (then continue to the next device). Change-Id: If4f35b140b6089e02729b1490ed6b48d614a122a
This commit is contained in:
@@ -2161,6 +2161,10 @@ def showSerialNumber(deviceList):
|
||||
for device in deviceList:
|
||||
sn = create_string_buffer(256)
|
||||
ret = rocmsmi.rsmi_dev_serial_number_get(device, sn, 256)
|
||||
if not str(sn).isalnum():
|
||||
printErrLog(device, "FRU Serial Number contains non-alphanumeric characters. FRU is likely corrupted")
|
||||
continue
|
||||
|
||||
if rsmi_ret_ok(ret, device) and sn.value.decode():
|
||||
printLog(device, 'Serial Number', sn.value.decode())
|
||||
else:
|
||||
|
||||
Verwijs in nieuw issue
Block a user