Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b51f232f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: mdss: avoid overflow in mdp clock rate calculation for rotator"

parents c7496f31 f173ec50
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1034,8 +1034,16 @@ static int mdss_rotator_calc_perf(struct mdss_rot_perf *perf)
		pr_err("invalid output format\n");
		return -EINVAL;
	}
	if (!config->input.width ||
		(0xffffffff/config->input.width < config->input.height))
		return -EINVAL;

	perf->clk_rate = config->input.width * config->input.height;

	if (!perf->clk_rate ||
		(0xffffffff/perf->clk_rate < config->frame_rate))
		return -EINVAL;

	perf->clk_rate *= config->frame_rate;
	/* rotator processes 4 pixels per clock */
	perf->clk_rate /= 4;