From: Alex Deucher Date: Wed, 30 Jun 2021 15:19:14 +0000 (-0400) Subject: drm/amdgpu: fix 64 bit divide in eeprom code X-Git-Tag: accepted/tizen/unified/20230118.172025~6402^2~20^2~192 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d456f3875af2eb5bf5a9cbd526622801ffc51037;p=platform%2Fkernel%2Flinux-rpi.git drm/amdgpu: fix 64 bit divide in eeprom code pos is 64 bits. Fixes: c65b0805e77919 ("drm/amdgpu: RAS EEPROM table is now in debugfs") Cc: luben.tuikov@amd.com Reported-by: kernel test robot Reviewed-by: Luben Tuikov Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c index 677e379..fc70620 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c @@ -880,13 +880,17 @@ static ssize_t amdgpu_ras_debugfs_table_read(struct file *f, char __user *buf, if (*pos < data_len && size > 0) { u8 dare[RAS_TABLE_RECORD_SIZE]; u8 data[rec_hdr_fmt_size + 1]; + struct eeprom_table_record record; + int s, r; + /* Find the starting record index */ - int s = (*pos - strlen(tbl_hdr_str) - tbl_hdr_fmt_size - - strlen(rec_hdr_str)) / rec_hdr_fmt_size; - int r = (*pos - strlen(tbl_hdr_str) - tbl_hdr_fmt_size - - strlen(rec_hdr_str)) % rec_hdr_fmt_size; - struct eeprom_table_record record; + s = *pos - strlen(tbl_hdr_str) - tbl_hdr_fmt_size - + strlen(rec_hdr_str); + s = s / rec_hdr_fmt_size; + r = *pos - strlen(tbl_hdr_str) - tbl_hdr_fmt_size - + strlen(rec_hdr_str); + r = r % rec_hdr_fmt_size; for ( ; size > 0 && s < control->ras_num_recs; s++) { u32 ai = RAS_RI_TO_AI(control, s);