msm-camera: Addressing possible overflow conditions

Changes to address possible integer overflow and incorrect
array indexing conditions.

Change-Id: Ib134320cd6f7b34d7a10572ec347ec12127049a9
Signed-off-by: Trilokesh Rangam <tranga@codeaurora.org>
Signed-off-by: Yang Guang <guyang@codeaurora.org>
This commit is contained in:
guyang 2016-12-09 19:05:24 +08:00 committed by Gerrit - the friendly Code Review server
parent 368fecd7df
commit 0cd36b78f9

View file

@ -394,6 +394,12 @@ int msm_camera_config_vreg(struct device *dev, struct camera_vreg_t *cam_vreg,
pr_err("%s:%d vreg sequence invalid\n", __func__, __LINE__); pr_err("%s:%d vreg sequence invalid\n", __func__, __LINE__);
return -EINVAL; return -EINVAL;
} }
if (cam_vreg == NULL) {
pr_err("%s:%d cam_vreg sequence invalid\n", __func__, __LINE__);
return -EINVAL;
}
if (!num_vreg_seq) if (!num_vreg_seq)
num_vreg_seq = num_vreg; num_vreg_seq = num_vreg;