diff --git a/drivers/media/platform/msm/vidc/msm_vidc.c b/drivers/media/platform/msm/vidc/msm_vidc.c
index 6c7205ad909e5031c0d34afa7446809e057fbb85..77b29cc18c919abf5e6b1c988c85a153c84e78b6 100644
--- a/drivers/media/platform/msm/vidc/msm_vidc.c
+++ b/drivers/media/platform/msm/vidc/msm_vidc.c
@@ -701,6 +701,13 @@ int msm_vidc_prepare_buf(void *instance, struct v4l2_buffer *b)
 	if (!inst || !b)
 		return -EINVAL;
 
+	if (!V4L2_TYPE_IS_MULTIPLANAR(b->type) || !b->length ||
+		(b->length > VIDEO_MAX_PLANES)) {
+		dprintk(VIDC_ERR, "%s: wrong input params\n",
+				__func__);
+		return -EINVAL;
+	}
+
 	if (is_dynamic_output_buffer_mode(b, inst)) {
 		dprintk(VIDC_ERR, "%s: not supported in dynamic buffer mode\n",
 				__func__);
@@ -843,9 +850,10 @@ int msm_vidc_qbuf(void *instance, struct v4l2_buffer *b)
 	if (!inst || !b)
 		return -EINVAL;
 
-	if (b->length > VIDEO_MAX_PLANES) {
-		dprintk(VIDC_ERR, "num planes exceeds max: %d\n",
-			b->length);
+	if (!V4L2_TYPE_IS_MULTIPLANAR(b->type) || !b->length ||
+		(b->length > VIDEO_MAX_PLANES)) {
+		dprintk(VIDC_ERR, "%s: wrong input params\n",
+				__func__);
 		return -EINVAL;
 	}
 
@@ -916,9 +924,10 @@ int msm_vidc_dqbuf(void *instance, struct v4l2_buffer *b)
 	if (!inst || !b)
 		return -EINVAL;
 
-	if (b->length > VIDEO_MAX_PLANES) {
-		dprintk(VIDC_ERR, "num planes exceed maximum: %d\n",
-			b->length);
+	if (!V4L2_TYPE_IS_MULTIPLANAR(b->type) || !b->length ||
+		(b->length > VIDEO_MAX_PLANES)) {
+		dprintk(VIDC_ERR, "%s: wrong input params\n",
+				__func__);
 		return -EINVAL;
 	}