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

Commit 1aa5d272 authored by Lina Iyer's avatar Lina Iyer
Browse files

drivers: qcom: rpmh: Check for valid input



Check the input arguments and make sure they are valid in write_passthru
API.

Change-Id: I5a840c5237c948d160640d0a130376a9938eae5a
Signed-off-by: default avatarLina Iyer <ilina@codeaurora.org>
parent deda3be7
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -463,6 +463,9 @@ int rpmh_write_passthru(struct rpmh_client *rc, enum rpmh_state state,
	unsigned long flags;
	struct rpmh_mbox *rpm;

	if (IS_ERR_OR_NULL(rc) || !cmd || !n)
		return -EINVAL;

	if (rpmh_standalone)
		return 0;

@@ -478,7 +481,7 @@ int rpmh_write_passthru(struct rpmh_client *rc, enum rpmh_state state,
	while (n[count++])
		;
	count--;
	if (count >= RPMH_MAX_REQ_IN_BATCH)
	if (!count || count >= RPMH_MAX_REQ_IN_BATCH)
		return -EINVAL;

	if (state == RPMH_ACTIVE_ONLY_STATE || state == RPMH_AWAKE_STATE) {