diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2019-02-25 12:51:52 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2019-02-25 12:51:51 -0800 |
commit | 9677c9ff2ca4686789592ad440a5f4c617fea92e (patch) | |
tree | 1d810ac53c2203404abcb5af047091ccc9fa98af | |
parent | 203aded106303ffc49404ce6fba0e9c517c582f0 (diff) | |
parent | d83064a7b3e205007926512bdcc39cdc4fa879d1 (diff) |
Merge "msm: camera: isp: Fix invalid type conversion"LE.UM.2.3.7-09900-sda845.0
-rw-r--r-- | drivers/media/platform/msm/camera_v2/ispif/msm_ispif.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/drivers/media/platform/msm/camera_v2/ispif/msm_ispif.c b/drivers/media/platform/msm/camera_v2/ispif/msm_ispif.c index 512fdb916127..652b0c3868f6 100644 --- a/drivers/media/platform/msm/camera_v2/ispif/msm_ispif.c +++ b/drivers/media/platform/msm/camera_v2/ispif/msm_ispif.c @@ -212,32 +212,34 @@ static long msm_ispif_cmd_ext(struct v4l2_subdev *sd, long rc = 0; struct ispif_device *ispif = (struct ispif_device *)v4l2_get_subdevdata(sd); - struct ispif_cfg_data_ext pcdata; + struct ispif_cfg_data_ext pcdata = {0}; struct msm_ispif_param_data_ext *params = NULL; -#ifdef CONFIG_COMPAT - struct ispif_cfg_data_ext_32 *pcdata32 = - (struct ispif_cfg_data_ext_32 *)arg; - if (pcdata32 == NULL) { - pr_err("Invalid params passed from user\n"); - return -EINVAL; - } - pcdata.cfg_type = pcdata32->cfg_type; - pcdata.size = pcdata32->size; - pcdata.data = compat_ptr(pcdata32->data); + if (is_compat_task()) { +#ifdef CONFIG_COMPAT + struct ispif_cfg_data_ext_32 *pcdata32 = + (struct ispif_cfg_data_ext_32 *)arg; -#else - struct ispif_cfg_data_ext *pcdata64 = + if (pcdata32 == NULL) { + pr_err("Invalid params passed from user\n"); + return -EINVAL; + } + pcdata.cfg_type = pcdata32->cfg_type; + pcdata.size = pcdata32->size; + pcdata.data = compat_ptr(pcdata32->data); +#endif + } else { + struct ispif_cfg_data_ext *pcdata64 = (struct ispif_cfg_data_ext *)arg; - if (pcdata64 == NULL) { - pr_err("Invalid params passed from user\n"); - return -EINVAL; + if (pcdata64 == NULL) { + pr_err("Invalid params passed from user\n"); + return -EINVAL; + } + pcdata.cfg_type = pcdata64->cfg_type; + pcdata.size = pcdata64->size; + pcdata.data = pcdata64->data; } - pcdata.cfg_type = pcdata64->cfg_type; - pcdata.size = pcdata64->size; - pcdata.data = pcdata64->data; -#endif if (pcdata.size != sizeof(struct msm_ispif_param_data_ext)) { pr_err("%s: payload size mismatch\n", __func__); return -EINVAL; |