From 58847a6593067b0c61ddfa7f30b7f0c1e88b2e1f Mon Sep 17 00:00:00 2001 From: Bruno Melo Date: Fri, 7 Jan 2022 11:36:35 -0400 Subject: [PATCH] Revert "Revert "msm: camera: ife: Add ife num outport bound checks"" Adding back: msm: camera: ife: Add ife num outport bound checks. QC helped us to investigate the stability issue on Berlin/BerlinNA caused by the reverted change. ISP output number was being set incorectly on camx for Astro165. This reverts commit f3bb3c280110fb2961afac73d214f1411e0cb839 Change-Id: I3e9aac8ae3bf81ccb6ffa7434a8db609c3c76525 Reviewed-on: https://gerrit.mot.com/2165129 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Gilberto Gambugge Neto Reviewed-by: Monica Mabuchi Submit-Approved: Jira Key --- .../isp_hw_mgr/hw_utils/cam_isp_packet_parser.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/cam_isp/isp_hw_mgr/hw_utils/cam_isp_packet_parser.c b/drivers/cam_isp/isp_hw_mgr/hw_utils/cam_isp_packet_parser.c index bf059c109e43..7357cfd9f77b 100644 --- a/drivers/cam_isp/isp_hw_mgr/hw_utils/cam_isp_packet_parser.c +++ b/drivers/cam_isp/isp_hw_mgr/hw_utils/cam_isp_packet_parser.c @@ -124,6 +124,12 @@ static int cam_isp_update_dual_config( cpu_addr += (cmd_desc->offset / 4); dual_config = (struct cam_isp_dual_config *)cpu_addr; + if (dual_config->num_ports > size_isp_out) { + CAM_ERR(CAM_ISP, "num_ports %d more than max_vfe_out_res %d", + dual_config->num_ports, size_isp_out); + return -EINVAL; + } + if ((dual_config->num_ports * sizeof(struct cam_isp_dual_stripe_config)) > (remain_len - offsetof(struct cam_isp_dual_config, stripes))) { @@ -132,14 +138,6 @@ static int cam_isp_update_dual_config( } for (i = 0; i < dual_config->num_ports; i++) { - if (i >= CAM_ISP_IFE_OUT_RES_BASE + size_isp_out) { - CAM_ERR(CAM_ISP, - "failed update for i:%d > size_isp_out:%d", - i, size_isp_out); - rc = -EINVAL; - goto end; - } - hw_mgr_res = &res_list_isp_out[i]; if (!hw_mgr_res) { CAM_ERR(CAM_ISP,