[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <00000000000002b1dc060a6abc67@google.com>
Date: Sat, 18 Nov 2023 02:29:57 -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..ca481c7f23e1 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,15 @@ 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;
+ if (mode->vscan > 1) {
+ n1k = mul_u32_u32(num, 1000);
+ if (den < n1k)
+ den *= mode->vscan;
+ }
+ 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