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

Commit 4fb92ecc authored by Abdulla Anam's avatar Abdulla Anam
Browse files

msm: vidc: Fix kw reported issues.



Fix kw reported issues related to use of uninitialized variables
and possible out of memory bound access.

CRs-Fixed: 997966
Change-Id: I66973d7dcc0988dba36da4b3c0e01484847a7a7e
Signed-off-by: default avatarAbdulla Anam <abdullahanam@codeaurora.org>
parent 53d1dd96
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -91,7 +91,7 @@ static int nal_type[] = {

static inline int hal_to_hfi_type(int property, int hal_type)
{
	if (hal_type && roundup_pow_of_two(hal_type) != hal_type) {
	if (hal_type <= 0 || roundup_pow_of_two(hal_type) != hal_type) {
		/* Not a power of 2, it's not going
		 * to be in any of the tables anyway */
		return -EINVAL;
+14 −11
Original line number Diff line number Diff line
@@ -3334,8 +3334,8 @@ exit:
int msm_vidc_comm_cmd(void *instance, union msm_v4l2_cmd *cmd)
{
	struct msm_vidc_inst *inst = instance;
	struct v4l2_decoder_cmd *dec;
	struct v4l2_encoder_cmd *enc;
	struct v4l2_decoder_cmd *dec = NULL;
	struct v4l2_encoder_cmd *enc = NULL;
	struct msm_vidc_core *core;
	int which_cmd = 0, flags = 0, rc = 0;

@@ -3386,18 +3386,21 @@ int msm_vidc_comm_cmd(void *instance, union msm_v4l2_cmd *cmd)

		output_buf = get_buff_req_buffer(inst,
				msm_comm_get_hal_output_buffer(inst));
		if (!output_buf) {
			dprintk(VIDC_DBG,
					"This output buffer not required, buffer_type: %x\n",
					HAL_BUFFER_OUTPUT);
		} else {
		if (output_buf) {
			if (dec) {
				ptr = (u32 *)dec->raw.data;
				ptr[0] = output_buf->buffer_size;
				ptr[1] = output_buf->buffer_count_actual;
				dprintk(VIDC_DBG,
					"Reconfig hint, size is %u, count is %u\n",
					ptr[0], ptr[1]);

			} else {
				dprintk(VIDC_ERR, "Null decoder\n");
			}
		} else {
			dprintk(VIDC_DBG,
					"This output buffer not required, buffer_type: %x\n",
					HAL_BUFFER_OUTPUT);
		}
		break;
	}
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -73,7 +73,7 @@ static ssize_t core_info_read(struct file *file, char __user *buf,
{
	struct msm_vidc_core *core = file->private_data;
	struct hfi_device *hdev;
	struct hal_fw_info fw_info;
	struct hal_fw_info fw_info = { {0} };
	int i = 0, rc = 0;

	if (!core || !core->device) {