From 2660d4863898f6c4149ded637e9c9c1e893ff1b7 Mon Sep 17 00:00:00 2001 From: Bindhiya Kanangot Balakrishnan Date: Tue, 3 Dec 2024 11:01:11 -0600 Subject: [PATCH] [SWDEV-499030] Fix truncated FRU_ID The FRU_ID was truncated because the string copied from sysfs was limited to 32 characters. This limit has been increased to AMDSMI_MAX_STRING_LENGTH to accommodate longer FRU_IDs. Also updated the deprecated string length macros. Signed-off-by: Bindhiya Kanangot Balakrishnan Change-Id: I8becaf9f37609b2e5aecdf92b6ae60f4419ad8ef (cherry picked from commit bc77330a744fc9b9c39fbb975191db9466abfb95) --- src/amd_smi/amd_smi_utils.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/amd_smi/amd_smi_utils.cc b/src/amd_smi/amd_smi_utils.cc index 51584b00..b383a8f3 100644 --- a/src/amd_smi/amd_smi_utils.cc +++ b/src/amd_smi/amd_smi_utils.cc @@ -188,12 +188,11 @@ amdsmi_status_t smi_amdgpu_get_board_info(amd::smi::AMDSmiGPUDevice* device, amd std::string manufacturer_name_path = "/sys/class/drm/" + device->get_gpu_path() + std::string("/device/manufacturer"); std::string product_name_path = "/sys/class/drm/" + device->get_gpu_path() + std::string("/device/product_name"); - openFileAndModifyBuffer(model_number_path, info->model_number, AMDSMI_256_LENGTH); - openFileAndModifyBuffer(product_serial_path, info->product_serial, AMDSMI_NORMAL_STRING_LENGTH); - openFileAndModifyBuffer(fru_id_path, info->fru_id, AMDSMI_NORMAL_STRING_LENGTH); - openFileAndModifyBuffer(manufacturer_name_path, info->manufacturer_name, - AMDSMI_MAX_STRING_LENGTH); - openFileAndModifyBuffer(product_name_path, info->product_name, AMDSMI_256_LENGTH); + openFileAndModifyBuffer(model_number_path, info->model_number, AMDSMI_MAX_STRING_LENGTH); + openFileAndModifyBuffer(product_serial_path, info->product_serial, AMDSMI_MAX_STRING_LENGTH); + openFileAndModifyBuffer(fru_id_path, info->fru_id, AMDSMI_MAX_STRING_LENGTH); + openFileAndModifyBuffer(manufacturer_name_path, info->manufacturer_name, AMDSMI_MAX_STRING_LENGTH); + openFileAndModifyBuffer(product_name_path, info->product_name, AMDSMI_MAX_STRING_LENGTH); std::ostringstream ss; ss << __PRETTY_FUNCTION__ << "[Before correction] "