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

Commit b722769c authored by Kamen Kirov's avatar Kamen Kirov
Browse files

camera_v2: JPEG 1.0: add alignment check on register offset



Adds a check on the offset value in msm_jpeg_hw_cmd structure
for correct alignment.

CRs-fixed: 576560
Signed-off-by: default avatarKamen Kirov <kkirov@codeaurora.org>
Change-Id: I9233cf6b7b300958188d2c95fb5a2c5f7a1e9cfb
parent f01d1b33
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2013, 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
@@ -337,6 +337,11 @@ int msm_jpeg_hw_exec_cmds(struct msm_jpeg_hw_cmd *hw_cmd_p, uint32_t m_cmds,
				__LINE__, hw_cmd_p->offset, max_size);
			return -EFAULT;
		}
		if (hw_cmd_p->offset & 0x3) {
			JPEG_PR_ERR("%s:%d] %d Invalid alignment\n", __func__,
					__LINE__, hw_cmd_p->offset);
			return -EFAULT;
		}

		switch (hw_cmd_p->type) {
		case MSM_JPEG_HW_CMD_TYPE_READ:
+2 −0
Original line number Diff line number Diff line
@@ -669,6 +669,8 @@ int msm_jpeg_ioctl_hw_cmd(struct msm_jpeg_device *pgmn_dev,
			JPEG_PR_ERR("%s:%d] failed\n", __func__, __LINE__);
			return -EFAULT;
		}
	} else {
		return is_copy_to_user;
	}

	return 0;