diff options
| author | Srinivasan Shanmugam <[email protected]> | 2024-05-07 16:26:07 +0000 |
|---|---|---|
| committer | Alex Deucher <[email protected]> | 2024-05-08 19:17:07 +0000 |
| commit | ffd574459df43bbb31a0ee67ce9c5b2f4d88eddb (patch) | |
| tree | 3ecdddb2178cca28dbdc5d8631d7e2b7ffddf7ac /drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |
| parent | drm/amdgpu: fix mc_data out-of-bounds read warning (diff) | |
| download | kernel-ffd574459df43bbb31a0ee67ce9c5b2f4d88eddb.tar.gz kernel-ffd574459df43bbb31a0ee67ce9c5b2f4d88eddb.zip | |
drm/amdgpu: Fix truncation by resizing ucode_prefix in imu_v12_0_init_microcode
This commit fixes potential truncation when writing the string _imu.bin
into the fw_name buffer in the imu_v12_0_init_microcode function in the
imu_v12_0.c file
The ucode_prefix size was reduced from 30 to 15 to ensure the snprintf
function does not exceed the size of the fw_name buffer.
Thus fixing the below with gcc W=1:
drivers/gpu/drm/amd/amdgpu/imu_v12_0.c: In function ‘imu_v12_0_init_microcode’:
drivers/gpu/drm/amd/amdgpu/imu_v12_0.c:51:54: warning: ‘_imu.bin’ directive output may be truncated writing 8 bytes into a region of size between 4 and 33 [-Wformat-truncation=]
51 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_imu.bin", ucode_prefix);
| ^~~~~~~~
drivers/gpu/drm/amd/amdgpu/imu_v12_0.c:51:9: note: ‘snprintf’ output between 16 and 45 bytes into a destination of size 40
51 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_imu.bin", ucode_prefix);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cc: Lijo Lazar <[email protected]>
Cc: Christian König <[email protected]>
Cc: Alex Deucher <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
Reviewed-by: Lijo Lazar <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c')
0 files changed, 0 insertions, 0 deletions
