mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-27 23:49:40 -04:00
drm/amdgpu: add first record offset check
check the upper and lower limits of first record offset Signed-off-by: Gangliang Xie <ganglxie@amd.com> Reviewed-by: Tao Zhou <tao.zhou1@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
a99cd231cd
commit
4073cdf671
@@ -1634,6 +1634,14 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control)
|
||||
}
|
||||
|
||||
control->ras_fri = RAS_OFFSET_TO_INDEX(control, hdr->first_rec_offset);
|
||||
if (hdr->first_rec_offset < control->ras_record_offset ||
|
||||
control->ras_fri >= control->ras_max_record_count) {
|
||||
dev_err(adev->dev,
|
||||
"RAS header invalid, ras_fri: %u, first_rec_offset:0x%x",
|
||||
control->ras_fri, hdr->first_rec_offset);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
control->ras_num_mca_recs = 0;
|
||||
control->ras_num_pa_recs = 0;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user