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

Commit 8382393b authored by Hardik Arya's avatar Hardik Arya
Browse files

diag: Properly reallocate dci cmd response buffer



Currently, reallocating dci cmd response buffer with
krealloc which is allocated with vzalloc. The patch
properly reallocates the same buffer.

Change-Id: Ic51ba0a6a06d1d285fb73135045d553b11374a56
Signed-off-by: default avatarHardik Arya <harya@codeaurora.org>
parent 297cd64d
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -1048,9 +1048,7 @@ void extract_dci_pkt_rsp(unsigned char *buf, int len, int data_source,
	 */
	if ((rsp_buf->data_len + 9 + rsp_len) > rsp_buf->capacity) {
		pr_alert("diag: create capacity for pkt rsp\n");
		rsp_buf->capacity += 9 + rsp_len;
		temp_buf = krealloc(rsp_buf->data, rsp_buf->capacity,
				    GFP_KERNEL);
		temp_buf = vzalloc(rsp_buf->capacity + 9 + rsp_len);
		if (!temp_buf) {
			pr_err("diag: DCI realloc failed\n");
			mutex_unlock(&rsp_buf->data_mutex);
@@ -1058,6 +1056,10 @@ void extract_dci_pkt_rsp(unsigned char *buf, int len, int data_source,
			mutex_unlock(&driver->dci_mutex);
			return;
		}
		rsp_buf->capacity += 9 + rsp_len;
		if (rsp_buf->capacity > rsp_buf->data_len)
			memcpy(temp_buf, rsp_buf->data, rsp_buf->data_len);
		vfree(rsp_buf->data);
		rsp_buf->data = temp_buf;
	}