Skip to content

Commit

Permalink
[SWDEV-499030] Fix truncated FRU_ID
Browse files Browse the repository at this point in the history
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 <[email protected]>
Change-Id: I8becaf9f37609b2e5aecdf92b6ae60f4419ad8ef
(cherry picked from commit bc77330)
  • Loading branch information
bkanango authored and rocm-devops committed Dec 24, 2024
1 parent f3e1fa4 commit 2660d48
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/amd_smi/amd_smi_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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] "
Expand Down

0 comments on commit 2660d48

Please sign in to comment.