msm: camera: isp: Fix memdup_user sanity check
memdup_user return ERR_PTR in an error scenarios like invalid source
pointer or unable to allocate destination memory. Checking the return
address against integer zero in error case can fail as memdup_user
returns ERR_PTR(non zero ptr value) instead or NULL
Change-Id: I697fe4de5288223bced800506ed6e02904b5d636
Signed-off-by: Tony Lijo Jose <tjose@codeaurora.org>
diff --git a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c
index db4ca2d..ce5641b 100644
--- a/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c
+++ b/drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c
@@ -1418,7 +1418,7 @@
in_port = memdup_user((void __user *)isp_resource[i].res_hdl,
isp_resource[i].length);
- if (in_port > 0) {
+ if (!IS_ERR(in_port)) {
rc = cam_ife_mgr_acquire_hw_for_ctx(ife_ctx, in_port,
&num_pix_port_per_in, &num_rdi_port_per_in);
total_pix_port += num_pix_port_per_in;