qseecom : qseecom_scale_bus_bandwidth doesn't check the negative mode

Place a min value check in qseecom_scale_bus_bandwidth

Change-Id: I6b551ee82987d2d7a2011e5d5fb667699d089a78
Signed-off-by: Nitin LNU <quic_nlakra@quicinc.com>
This commit is contained in:
Nitin LNU 2022-03-16 19:19:28 +05:30
parent 90de98dfa4
commit bb0d7a5112

View File

@ -3,6 +3,7 @@
* QTI Secure Execution Environment Communicator (QSEECOM) driver
*
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#define pr_fmt(fmt) "QSEECOM: %s: " fmt, __func__
@ -1933,7 +1934,7 @@ static int qseecom_scale_bus_bandwidth(struct qseecom_dev_handle *data,
pr_err("copy_from_user failed\n");
return ret;
}
if (req_mode > HIGH) {
if (req_mode > HIGH || req_mode < QSEECOM_STATE_NOT_READY) {
pr_err("Invalid bandwidth mode (%d)\n", req_mode);
return -EINVAL;
}