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

Commit 92ddcb89 authored by Arun Kumar Neelakantam's avatar Arun Kumar Neelakantam
Browse files

soc: qcom: qmi_interface: Limit txn ids to U16_MAX



Txn IDs created up to INT_MAX cause overflow while storing
the IDs in u16 type supported by QMI header.

Limit the txn IDs max value to U16_MAX to avoid overflow.

Change-Id: I77e2176df7ae6e91a52f470a4e9a83711ea784d5
Signed-off-by: default avatarArun Kumar Neelakantam <aneela@codeaurora.org>
parent 1cef27dd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -324,7 +324,7 @@ int qmi_txn_init(struct qmi_handle *qmi, struct qmi_txn *txn,
	txn->dest = c_struct;

	mutex_lock(&qmi->txn_lock);
	ret = idr_alloc_cyclic(&qmi->txns, txn, 0, INT_MAX, GFP_KERNEL);
	ret = idr_alloc_cyclic(&qmi->txns, txn, 0, U16_MAX, GFP_KERNEL);
	if (ret < 0)
		pr_err("failed to allocate transaction id\n");

+1 −1
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ struct qmi_ops {
struct qmi_txn {
	struct qmi_handle *qmi;

	int id;
	u16 id;

	struct mutex lock;
	struct completion completion;