File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -1287,21 +1287,24 @@ EXPORT_SYMBOL(drm_mode_set_name);
1287
1287
*/
1288
1288
int drm_mode_vrefresh (const struct drm_display_mode * mode )
1289
1289
{
1290
- unsigned int num , den ;
1290
+ unsigned int num = 1 , den = 1 ;
1291
1291
1292
1292
if (mode -> htotal == 0 || mode -> vtotal == 0 )
1293
1293
return 0 ;
1294
1294
1295
- num = mode -> clock ;
1296
- den = mode -> htotal * mode -> vtotal ;
1297
-
1298
1295
if (mode -> flags & DRM_MODE_FLAG_INTERLACE )
1299
1296
num *= 2 ;
1300
1297
if (mode -> flags & DRM_MODE_FLAG_DBLSCAN )
1301
1298
den *= 2 ;
1302
1299
if (mode -> vscan > 1 )
1303
1300
den *= mode -> vscan ;
1304
1301
1302
+ if (check_mul_overflow (mode -> clock , num , & num ))
1303
+ return 0 ;
1304
+
1305
+ if (check_mul_overflow (mode -> htotal * mode -> vtotal , den , & den ))
1306
+ return 0 ;
1307
+
1305
1308
return DIV_ROUND_CLOSEST_ULL (mul_u32_u32 (num , 1000 ), den );
1306
1309
}
1307
1310
EXPORT_SYMBOL (drm_mode_vrefresh );
You can’t perform that action at this time.
0 commit comments