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

Commit 213ebe02 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Fix calculation of size in _load_regfile"

parents 76dc54b4 8fa76855
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -1197,8 +1197,8 @@ static void _load_regfile(struct adreno_device *adreno_dev)
{
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
	const struct firmware *fw;
	uint32_t block_size = 0, block_total = 0, fw_size;
	uint32_t *block;
	uint64_t block_size = 0, block_total = 0;
	uint32_t fw_size, *block;
	int ret = -EINVAL;

	if (!adreno_dev->gpucore->regfw_name)
@@ -1220,7 +1220,8 @@ static void _load_regfile(struct adreno_device *adreno_dev)
	/* All offset numbers calculated from file description */
	while (block_total < fw_size) {
		block_size = block[0];
		if (block_size >= fw_size || block_size < 2)
		if (((block_total + block_size) >= fw_size)
				|| block_size < 5)
			goto err;
		if (block[1] != GPMU_SEQUENCE_ID)
			goto err;
@@ -1236,6 +1237,9 @@ static void _load_regfile(struct adreno_device *adreno_dev)
				goto err;

			adreno_dev->lm_fw = fw;

			if (block[2] > (block_size - 2))
				goto err;
			adreno_dev->lm_sequence = block + block[2] + 3;
			adreno_dev->lm_size = block_size - block[2] - 2;
		}
@@ -1248,7 +1252,7 @@ static void _load_regfile(struct adreno_device *adreno_dev)
err:
	release_firmware(fw);
	KGSL_PWR_ERR(device,
		"Register file failed to load sz=%d bsz=%d header=%d\n",
		"Register file failed to load sz=%d bsz=%llu header=%d\n",
		fw_size, block_size, ret);
	return;
}