mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-25 10:42:21 +03:00
media: i2c: Fix camera driver Coverity defects
Fix the below Coverity defects for IMX390 and AR0234 sensor driver Memory corruptions CID: 10171410 Unchecked return value CID: 10171825 Bug 3952896 Change-Id: Iff8a557ea3240a7aafd3e8e66fd6716dd28ac201 Signed-off-by: Ankur Pawar <ankurp@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2888806 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
f9a0264f89
commit
3be100e555
@@ -640,6 +640,10 @@ static int ar0234_fill_eeprom(struct tegracam_device *tc_dev,
|
||||
|
||||
switch (ctrl->id) {
|
||||
case TEGRA_CAMERA_CID_STEREO_EEPROM:
|
||||
if (AR0234_EEPROM_SIZE >
|
||||
sizeof(struct LiEeprom_Content_Struct))
|
||||
return -EINVAL;
|
||||
|
||||
tmp = kmalloc(sizeof(struct LiEeprom_Content_Struct),
|
||||
GFP_KERNEL);
|
||||
if (tmp == NULL)
|
||||
@@ -649,8 +653,7 @@ static int ar0234_fill_eeprom(struct tegracam_device *tc_dev,
|
||||
sizeof(struct NvCamSyncSensorCalibData));
|
||||
memset(ctrl->p_new.p, 0,
|
||||
sizeof(struct NvCamSyncSensorCalibData));
|
||||
memcpy(tmp, priv->eeprom_buf,
|
||||
sizeof(struct LiEeprom_Content_Struct));
|
||||
memcpy(tmp, priv->eeprom_buf, AR0234_EEPROM_SIZE);
|
||||
|
||||
if (priv->sync_sensor_index == 1)
|
||||
priv->EepromCalib.cam_intr = tmp->left_cam_intr;
|
||||
|
||||
@@ -716,8 +716,13 @@ static int imx390_board_setup(struct imx390 *priv)
|
||||
}
|
||||
|
||||
for (i = 0; i < priv->g_ctx.num_streams; i++) {
|
||||
of_property_read_string_index(gmsl, "streams", i,
|
||||
&str_value1[i]);
|
||||
err = of_property_read_string_index(gmsl, "streams", i,
|
||||
&str_value1[i]);
|
||||
if (err < 0) {
|
||||
dev_err(dev, "Failed to get streams index\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!str_value1[i]) {
|
||||
dev_err(dev, "invalid stream info\n");
|
||||
err = -EINVAL;
|
||||
|
||||
Reference in New Issue
Block a user