[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <00000000000028ab9d060a6bfcf2@google.com>
Date: Sat, 18 Nov 2023 03:59:28 -0800
From: syzbot <syzbot+2e93e6fb36e6fdc56574@...kaller.appspotmail.com>
To: linux-kernel@...r.kernel.org
Subject: Re: [syzbot] [PATCH] Test divide err in drm
For archival purposes, forwarding an incoming command email to
linux-kernel@...r.kernel.org.
***
Subject: [PATCH] Test divide err in drm
Author: eadavis@...com
please test divide err in drm
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ac347a0655db
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index ac9a406250c5..539aa26cfc72 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1285,7 +1285,8 @@ EXPORT_SYMBOL(drm_mode_set_name);
*/
int drm_mode_vrefresh(const struct drm_display_mode *mode)
{
- unsigned int num, den;
+ unsigned int num, den, n1k;
+ int ret;
if (mode->htotal == 0 || mode->vtotal == 0)
return 0;
@@ -1297,9 +1298,17 @@ int drm_mode_vrefresh(const struct drm_display_mode *mode)
num *= 2;
if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
den *= 2;
- if (mode->vscan > 1)
- den *= mode->vscan;
+ n1k = mul_u32_u32(num, 1000);
+ if (mode->vscan > 1) {
+ if (den < n1k)
+ den *= mode->vscan;
+ }
+ if (den < n1k)
+ den = n1k + 1;
+ ret = DIV_ROUND_CLOSEST_ULL(mul_u32_u32(num, 1000), den);
+ printk("mode: %p, ht: %d, vt: %d, c: %d, vsc: %d, den: %ld, num: %ld, n1k: %ld, %d, %s",
+ mode, mode->htotal, mode->vtotal, mode->clock, mode->vscan, den, num, n1k, ret, __func__);
return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(num, 1000), den);
}
EXPORT_SYMBOL(drm_mode_vrefresh);
Powered by blists - more mailing lists