struct s5p_mfc_dev *dev = video_drvdata(file);
struct s5p_mfc_ctx *ctx = fh_to_mfc_ctx(file->private_data);
struct s5p_mfc_enc *enc = ctx->enc_priv;
- struct s5p_mfc_fmt *fmt;
+ struct s5p_mfc_fmt *fmt = NULL;
struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
int ret = 0;
return -EIO;
}
- if (V4L2_TYPE_IS_MULTIPLANAR(buf->type) && !buf->length) {
+ if (!V4L2_TYPE_IS_MULTIPLANAR(buf->type)) {
+ mfc_err_ctx("Invalid V4L2 Buffer for driver: type(%d)\n", buf->type);
+ return -EINVAL;
+ }
+
+ if (!buf->length) {
mfc_err_ctx("multiplanar but length is zero\n");
return -EIO;
}
if (buf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
- for (i = 0; i < ctx->src_fmt->num_planes; i++) {
+ if (ctx->src_fmt->mem_planes != buf->length) {
+ mfc_err_ctx("number of memory container miss-match "
+ "between Src planes(%d) and buffer length(%d)\n",
+ ctx->src_fmt->mem_planes, buf->length);
+ return -EINVAL;
+ }
+
+ for (i = 0; i < ctx->src_fmt->mem_planes; i++) {
if (!buf->m.planes[i].bytesused) {
mfc_debug(2, "Src input[%d] size zero, "
"changed to buf size %d\n",
mfc_err_ctx("Call on DQBUF after unrecoverable error.\n");
return -EIO;
}
+
+ if (!V4L2_TYPE_IS_MULTIPLANAR(buf->type)) {
+ mfc_err_ctx("Invalid V4L2 Buffer for driver: type(%d)\n", buf->type);
+ return -EINVAL;
+ }
+
if (buf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
ret = vb2_dqbuf(&ctx->vq_src, buf, file->f_flags & O_NONBLOCK);
else
int ret = -EINVAL;
mfc_debug_enter();
+
+ if (!V4L2_TYPE_IS_MULTIPLANAR(type)) {
+ mfc_err_ctx("Invalid V4L2 Buffer for driver: type(%d)\n", type);
+ return -EINVAL;
+ }
+
if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
ret = vb2_streamon(&ctx->vq_src, type);
enum v4l2_buf_type type)
{
struct s5p_mfc_ctx *ctx = fh_to_mfc_ctx(file->private_data);
- int ret;
+ int ret = -EINVAL;
mfc_debug_enter();
- ret = -EINVAL;
+
+ if (!V4L2_TYPE_IS_MULTIPLANAR(type)) {
+ mfc_err_ctx("Invalid V4L2 Buffer for driver: type(%d)\n", type);
+ return -EINVAL;
+ }
+
if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
s5p_mfc_qos_reset_last_framerate(ctx);