[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_9E786E6C4C2DF96F4097BCEA5AED66CEBC0A@qq.com>
Date: Mon, 12 Feb 2024 20:07:20 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+0d7a3627fb6a42cf0863@...kaller.appspotmail.com
Cc: linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: [PATCH] Test divide err in drm
please test divide err in drm
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index ac9a406250c5..60739d861da2 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,10 @@ 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) {
+ if (unlikely(check_mul_overflow(den, mode->vscan, &den)))
+ return 0;
+ }
return DIV_ROUND_CLOSEST_ULL(mul_u32_u32(num, 1000), den);
}
Powered by blists - more mailing lists