msm: camera: cci: Number of CCI masters index validation

Number of CCI masters index validation to avoid
out of bound array indices access.

CRs-Fixed: 3381768
Change-Id: I14d4a111cc5c7dab17d071446cddccd7651389a3
Signed-off-by: Abhilash Mahapatra <quic_abhmah@quicinc.com>
Цей коміт міститься в:
Abhilash Mahapatra
2023-02-09 16:28:33 +05:30
зафіксовано Camera Software Integration
джерело fb42ce28bc
коміт 3114739e59

Переглянути файл

@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/module.h>
@@ -1519,6 +1519,13 @@ static int32_t cam_cci_i2c_write(struct v4l2_subdev *sd,
return -EINVAL;
}
master = c_ctrl->cci_info->cci_i2c_master;
if (master >= MASTER_MAX || master < 0) {
CAM_ERR(CAM_CCI, "CCI%d_I2C_M%d Invalid I2C master addr",
cci_dev->soc_info.index,
master);
return -EINVAL;
}
CAM_DBG(CAM_CCI, "CCI%d_I2C_M%d_Q%d set param sid 0x%x retries %d id_map %d",
cci_dev->soc_info.index, master, queue, c_ctrl->cci_info->sid, c_ctrl->cci_info->retries,
c_ctrl->cci_info->id_map);