All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: fix 64 bit divide in eeprom code
@ 2021-06-30 15:25 Alex Deucher
  2021-06-30 16:24 ` Luben Tuikov
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Deucher @ 2021-06-30 15:25 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher, luben.tuikov, kernel test robot

pos is 64 bits.

Fixes: 5e98eafa90ca19 ("drm/amdgpu: RAS EEPROM table is now in debugfs")
Cc: luben.tuikov@amd.com
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
index 677e379f5fb5..fc70620369e4 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);
-- 
2.31.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amdgpu: fix 64 bit divide in eeprom code
  2021-06-30 15:25 [PATCH] drm/amdgpu: fix 64 bit divide in eeprom code Alex Deucher
@ 2021-06-30 16:24 ` Luben Tuikov
  0 siblings, 0 replies; 2+ messages in thread
From: Luben Tuikov @ 2021-06-30 16:24 UTC (permalink / raw)
  To: Alex Deucher, amd-gfx; +Cc: kernel test robot

Reviewed-by: Luben Tuikov <luben.tuikov@amd.com>

On 2021-06-30 11:25 a.m., Alex Deucher wrote:
> pos is 64 bits.
>
> Fixes: 5e98eafa90ca19 ("drm/amdgpu: RAS EEPROM table is now in debugfs")
> Cc: luben.tuikov@amd.com
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
> index 677e379f5fb5..fc70620369e4 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);

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-30 16:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-30 15:25 [PATCH] drm/amdgpu: fix 64 bit divide in eeprom code Alex Deucher
2021-06-30 16:24 ` Luben Tuikov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.