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

Commit 7c7e3ec1 authored by Mitchel Humpherys's avatar Mitchel Humpherys
Browse files

ion: secure_buffer: fix iteration of sg_table



We're currently re-using the `i' loop counter to iterate over the chunk
list within our iteration of the secure sg_table. This causes the
iteration of the sg_table to get all messed up and results in crashes
when we walk off the end of the list. Fix it.

Change-Id: I09c84015f8c3cbcb2cea60886241457bb829003c
Signed-off-by: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
parent 563010bc
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ static int secure_buffer_change_table(struct sg_table *table,
				enum cp_mem_usage usage,
				int lock)
{
	int i;
	int i, j;
	int ret = -EINVAL;
	unsigned long *chunk_list;
	struct scatterlist *sg;
@@ -154,8 +154,8 @@ static int secure_buffer_change_table(struct sg_table *table,
			return -ENOMEM;

		chunk_list_phys = virt_to_phys(chunk_list);
		for (i = 0; i < nchunks; i++)
			chunk_list[i] = base + i * V2_CHUNK_SIZE;
		for (j = 0; j < nchunks; j++)
			chunk_list[j] = base + j * V2_CHUNK_SIZE;

		/*
		 * Flush the chunk list before sending the memory to the