lkml.org 
[lkml]   [2023]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [syzbot] [PATCH] Test divide err in drm
From
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [PATCH] Test divide err in drm
Author: eadavis@qq.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..117ee4e41c63 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -36,6 +36,7 @@
#include <linux/list.h>
#include <linux/list_sort.h>
#include <linux/of.h>
+#include <linux/overflow.h>

#include <video/of_display_timing.h>
#include <video/of_videomode.h>
@@ -1297,8 +1298,11 @@ 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)
+ if (mode->vscan > 1) {
+ if (unlikely(check_mul_overflow(den, mode->vscan, &den)))
+ return 0;
den *= mode->vscan;
+ }

return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(num, 1000), den);
}
\
 
 \ /
  Last update: 2023-11-20 14:05    [W:0.150 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site