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

Commit 263d9691 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "diag: Properly reallocate dci cmd response buffer"

parents d92802c8 8382393b
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -1056,9 +1056,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);
@@ -1066,6 +1064,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;
	}