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

Commit 389fe017 authored by Katish Paran's avatar Katish Paran
Browse files

diag: dci: Check for valid peripheral before writing over to it



Currently while writing data to the peripherals over dci channel,
invalid channel access may happen. This patch add an error check
for such case.

Change-Id: I6a7bdb9c75c4863394dcab12b41387b081c2329f
Signed-off-by: default avatarKatish Paran <kparan@codeaurora.org>
parent 57301a09
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2871,7 +2871,7 @@ int diag_dci_write_proc(int peripheral, int pkt_type, char *buf, int len)
	struct diag_smd_info *smd_info = NULL;
	int err = 0;

	if (!buf || (peripheral < 0 || peripheral > NUM_SMD_DCI_CHANNELS)
	if (!buf || (peripheral < 0 || peripheral >= NUM_SMD_DCI_CHANNELS)
		|| !driver->rcvd_feature_mask[peripheral] || len < 0) {
		pr_err("diag: In %s, invalid data 0x%p, peripheral: %d, len: %d\n",
				__func__, buf, peripheral, len);