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

Commit ac6e850d authored by Lina Iyer's avatar Lina Iyer
Browse files

drivers: mailbox: rpmh: fix validation check in probe



Fix check for TCS configuration at probe.

Change-Id: Ia695bb7598aaaabe18297eaed5d1c80be088393d
Signed-off-by: default avatarLina Iyer <ilina@codeaurora.org>
parent b4a69c05
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -1178,11 +1178,10 @@ static int rsc_drv_probe(struct platform_device *pdev)
		if (tcs->num_tcs <= 0 || tcs->type == CONTROL_TCS)
			continue;

		if (tcs->num_tcs > MAX_TCS_PER_TYPE)
			return -EINVAL;

		if (st + tcs->num_tcs > max_tcs &&
				st + tcs->num_tcs >= sizeof(tcs->tcs_mask))
		if (tcs->num_tcs > MAX_TCS_PER_TYPE ||
			st + tcs->num_tcs > max_tcs ||
			st + tcs->num_tcs >=
				BITS_PER_BYTE * sizeof(tcs->tcs_mask))
			return -EINVAL;

		tcs->tcs_mask = ((1 << tcs->num_tcs) - 1) << st;