media: ipu3-cio2: Do not zero reserved fields
Subsystems (9)
PATCH 1/9 media: ipu3-cio2: Do not zero reserved fields
Core code already clears reserved fields of struct v4l2_pix_format_mplane, check: 4e1e0eb0e074 ("media: v4l2-ioctl: Zero v4l2_plane_pix_format reserved fields").
--- drivers/media/pci/intel/ipu3/ipu3-cio2.c | 3 --- 1 file changed, 3 deletions(-)
drivers/media/pci/intel/ipu3/ipu3-cio2.c +0 -3
@@ -1094,12 +1094,9 @@ static int cio2_v4l2_try_fmt(struct file *file, void *fh, struct v4l2_format *f) mpix->pixelformat = fmt->fourcc; mpix->colorspace =V4L2_COLORSPACE_RAW ; mpix->field =V4L2_FIELD_NONE ; -memset (mpix->reserved,0 ,sizeof (mpix->reserved)); mpix->plane_fmt[0 ].bytesperline =cio2_bytesperline (mpix->width); mpix->plane_fmt[0 ].sizeimage = mpix->plane_fmt[0 ].bytesperline * mpix->height; -memset (mpix->plane_fmt[0 ].reserved,0 , -sizeof (mpix->plane_fmt[0 ].reserved));/* use default */ mpix->ycbcr_enc =V4L2_YCBCR_ENC_DEFAULT ;
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7-goog
PATCH 1/1 media: staging/intel-ipu3 : Do not zero reserved fields
Core code already clears reserved fields of struct v4l2_pix_format_mplane, check: 4e1e0eb0e074 ("media: v4l2-ioctl: Zero v4l2_plane_pix_format reserved fields").
--- drivers/staging/media/ipu3/ipu3-v4l2.c | 3 --- 1 file changed, 3 deletions(-)
drivers/staging/media/ipu3/ipu3-v4l2.c +0 -3
@@ -773,9 +773,6 @@ static int imgu_try_fmt(struct file *file, void *fh, struct v4l2_format *f) pixm->pixelformat = fmt->fourcc; -memset (pixm->plane_fmt[0 ].reserved,0 , -sizeof (pixm->plane_fmt[0 ].reserved)); -return 0 ; }
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7-goog
Re: [PATCH] media: staging/intel-ipu3 : Do not zero reserved fields
Hi Ricardo,
Quoted 6 lines · Ricardo Ribalda
Core code already clears reserved fields of struct
v4l2_pix_format_mplane, check:4e1e0eb0e074("media: v4l2-ioctl: Zerov4l2_plane_pix_formatreserved fields").Cc Sakari Ailus <[email protected]>Signed-off-by Ricardo Ribalda <[email protected]>
This is just 9/9 of the series right ? ;-)
--
Kieran
Quoted 19 lines
--- drivers/staging/media/ipu3/ipu3-v4l2.c | 3 --- 1 file changed, 3 deletions(-)drivers/staging/media/ipu3/ipu3-v4l2.c +0
-3@@ -773,9 +773,6 @@ static int imgu_try_fmt(struct file *file, void *fh, struct v4l2_format *f) pixm->pixelformat = fmt->fourcc; -memset (pixm->plane_fmt[0 ].reserved,0 , -sizeof (pixm->plane_fmt[0 ].reserved)); -return 0 ; }
Re: [PATCH] media: staging/intel-ipu3 : Do not zero reserved fields
Hi Kieran
Quoted 4 lines · Kieran Bingham
Hi Ricardo,
On 11/01/2021 14:54, Ricardo Ribalda wrote:
Quoted 8 lines
Quoted 6 lines
Core code already clears reserved fields of struct
v4l2_pix_format_mplane, check:4e1e0eb0e074("media: v4l2-ioctl: Zerov4l2_plane_pix_formatreserved fields").Cc Sakari Ailus <[email protected]>Signed-off-by Ricardo Ribalda <[email protected]>This is just 9/9 of the series right ? ;-)
I was just testing that you were doing a good review :P
My bad, I sent the mails with git email-send 00* and I forgot to clean before :(. I already marked the patch as obsolete in patchwork. Sorry for wasting your time
Best regards!
Quoted 23 lines
--
KieranQuoted 19 lines
--- drivers/staging/media/ipu3/ipu3-v4l2.c | 3 --- 1 file changed, 3 deletions(-)drivers/staging/media/ipu3/ipu3-v4l2.c +0
-3@@ -773,9 +773,6 @@ static int imgu_try_fmt(struct file *file, void *fh, struct v4l2_format *f) pixm->pixelformat = fmt->fourcc; -memset (pixm->plane_fmt[0 ].reserved,0 , -sizeof (pixm->plane_fmt[0 ].reserved)); -return 0 ; }
Signature · 1 line
Ricardo Ribalda
PATCH 2/9 media: mtk-mdp: Do not zero reserved fields
In reply to Ricardo RibaldaCore code already clears reserved fields of struct v4l2_pix_format_mplane, check: 4e1e0eb0e074 ("media: v4l2-ioctl: Zero v4l2_plane_pix_format reserved fields").
--- drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c | 3 --- 1 file changed, 3 deletions(-)
drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c +0 -3
@@ -199,7 +199,6 @@ static const struct mtk_mdp_fmt *mtk_mdp_try_fmt_mplane(struct mtk_mdp_ctx *ctx, pix_mp->ycbcr_enc = ctx->ycbcr_enc; pix_mp->quantization = ctx->quant; } -memset (pix_mp->reserved,0 ,sizeof (pix_mp->reserved)); max_w = variant->pix_max->target_rot_dis_w; max_h = variant->pix_max->target_rot_dis_h;
@@ -247,8 +246,6 @@ static const struct mtk_mdp_fmt *mtk_mdp_try_fmt_mplane(struct mtk_mdp_ctx *ctx, pix_mp->plane_fmt[i].bytesperline = bpl;if (pix_mp->plane_fmt[i].sizeimage < sizeimage) pix_mp->plane_fmt[i].sizeimage = sizeimage; -memset (pix_mp->plane_fmt[i].reserved,0 , -sizeof (pix_mp->plane_fmt[i].reserved));mtk_mdp_dbg (2 ,"[%d] p%d, bpl:%d, sizeimage:%u (%u)" , ctx->id, i, bpl, pix_mp->plane_fmt[i].sizeimage, sizeimage); }
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7-goog
Re: [PATCH 2/9] media: mtk-mdp: Do not zero reserved fields
Hi Ricardo,
Quoted 6 lines · Ricardo Ribalda
Core code already clears reserved fields of struct
v4l2_pix_format_mplane, check:4e1e0eb0e074("media: v4l2-ioctl: Zerov4l2_plane_pix_formatreserved fields").Cc Matthias Brugger <[email protected]>Signed-off-by Ricardo Ribalda <[email protected]>
Quoted 26 lines
--- drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c | 3 --- 1 file changed, 3 deletions(-)drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c +0
-3@@ -199,7 +199,6 @@ static const struct mtk_mdp_fmt *mtk_mdp_try_fmt_mplane(struct mtk_mdp_ctx *ctx, pix_mp->ycbcr_enc = ctx->ycbcr_enc; pix_mp->quantization = ctx->quant; } -memset (pix_mp->reserved,0 ,sizeof (pix_mp->reserved)); max_w = variant->pix_max->target_rot_dis_w; max_h = variant->pix_max->target_rot_dis_h;@@ -247,8 +246,6 @@ static const struct mtk_mdp_fmt *mtk_mdp_try_fmt_mplane(struct mtk_mdp_ctx *ctx, pix_mp->plane_fmt[i].bytesperline = bpl;if (pix_mp->plane_fmt[i].sizeimage < sizeimage) pix_mp->plane_fmt[i].sizeimage = sizeimage; -memset (pix_mp->plane_fmt[i].reserved,0 , -sizeof (pix_mp->plane_fmt[i].reserved));mtk_mdp_dbg (2 ,"[%d] p%d, bpl:%d, sizeimage:%u (%u)" , ctx->id, i, bpl, pix_mp->plane_fmt[i].sizeimage, sizeimage); }
PATCH 3/9 media: mtk-vcodec: Do not zero reserved fields
In reply to Ricardo RibaldaCore code already clears reserved fields of struct v4l2_pix_format_mplane, check: 4e1e0eb0e074 ("media: v4l2-ioctl: Zero v4l2_plane_pix_format reserved fields").
--- drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c | 5 ----- drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 8 -------- 2 files changed, 13 deletions(-)
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c +0 -5
@@ -715,12 +715,7 @@ static int vidioc_try_fmt(struct v4l2_format *f, } } -for (i =0 ; i < pix_fmt_mp->num_planes; i++) -memset (&(pix_fmt_mp->plane_fmt[i].reserved[0 ]),0x0 , -sizeof (pix_fmt_mp->plane_fmt[0 ].reserved)); - pix_fmt_mp->flags =0 ; -memset (&pix_fmt_mp->reserved,0x0 ,sizeof (pix_fmt_mp->reserved));return 0 ; }
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +0 -8
@@ -320,13 +320,7 @@ static int vidioc_try_fmt(struct v4l2_format *f, } } -for (i =0 ; i < pix_fmt_mp->num_planes; i++) -memset (&(pix_fmt_mp->plane_fmt[i].reserved[0 ]),0x0 , -sizeof (pix_fmt_mp->plane_fmt[0 ].reserved)); - pix_fmt_mp->flags =0 ; -memset (&pix_fmt_mp->reserved,0x0 , -sizeof (pix_fmt_mp->reserved));return 0 ; }
@@ -532,8 +526,6 @@ static int vidioc_venc_g_fmt(struct file *file, void *priv,for (i =0 ; i < pix->num_planes; i++) { pix->plane_fmt[i].bytesperline = q_data->bytesperline[i]; pix->plane_fmt[i].sizeimage = q_data->sizeimage[i]; -memset (&(pix->plane_fmt[i].reserved[0 ]),0x0 , -sizeof (pix->plane_fmt[i].reserved)); } pix->flags =0 ;
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7-goog
Re: [PATCH 3/9] media: mtk-vcodec: Do not zero reserved fields
Hi Ricardo,
Quoted 6 lines · Ricardo Ribalda
Core code already clears reserved fields of struct
v4l2_pix_format_mplane, check:4e1e0eb0e074("media: v4l2-ioctl: Zerov4l2_plane_pix_formatreserved fields").Cc Matthias Brugger <[email protected]>Signed-off-by Ricardo Ribalda <[email protected]>
There's also another memset.*reserved occurring in
platform/mtk-vcodec/mtk_vcodec_enc.c: vidioc_enum_fmt()
While v4l2-core/v4l2-ioctl.c has:
Quoted 18 lines
static int v4l_enum_fmt(const struct
v4l2_ioctl_ops*ops,
struct file *file, void *fh, void *arg){ struct video_device *vdev = video_devdata(file); struct v4l2_fmtdesc *p = arg; int ret = check_fmt(file, p->type); u32 mbus_code; u32 cap_mask; if (ret) return ret; ret = -EINVAL; if (!(vdev->device_caps & V4L2_CAP_IO_MC)) p->mbus_code = 0; mbus_code = p->mbus_code; CLEAR_AFTER_FIELD(p, type);
So would that mean ^^^ should also be sufficient to remove the need for that memset?
With that fixed or resolved:
Quoted 50 lines
--- drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c | 5 ----- drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 8 -------- 2 files changed, 13 deletions(-)drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c +0
-5@@ -715,12 +715,7 @@ static int vidioc_try_fmt(struct v4l2_format *f, } } -for (i =0 ; i < pix_fmt_mp->num_planes; i++) -memset (&(pix_fmt_mp->plane_fmt[i].reserved[0 ]),0x0 , -sizeof (pix_fmt_mp->plane_fmt[0 ].reserved)); - pix_fmt_mp->flags =0 ; -memset (&pix_fmt_mp->reserved,0x0 ,sizeof (pix_fmt_mp->reserved));return 0 ; }drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +0
-8@@ -320,13 +320,7 @@ static int vidioc_try_fmt(struct v4l2_format *f, } } -for (i =0 ; i < pix_fmt_mp->num_planes; i++) -memset (&(pix_fmt_mp->plane_fmt[i].reserved[0 ]),0x0 , -sizeof (pix_fmt_mp->plane_fmt[0 ].reserved)); - pix_fmt_mp->flags =0 ; -memset (&pix_fmt_mp->reserved,0x0 , -sizeof (pix_fmt_mp->reserved));return 0 ; }@@ -532,8 +526,6 @@ static int vidioc_venc_g_fmt(struct file *file, void *priv,for (i =0 ; i < pix->num_planes; i++) { pix->plane_fmt[i].bytesperline = q_data->bytesperline[i]; pix->plane_fmt[i].sizeimage = q_data->sizeimage[i]; -memset (&(pix->plane_fmt[i].reserved[0 ]),0x0 , -sizeof (pix->plane_fmt[i].reserved)); } pix->flags =0 ;
PATCH 4/9 media: fdp1: Do not zero reserved fields
In reply to Ricardo RibaldaCore code already clears reserved fields of struct v4l2_pix_format_mplane, check: 4e1e0eb0e074 ("media: v4l2-ioctl: Zero v4l2_plane_pix_format reserved fields").
--- drivers/media/platform/rcar_fdp1.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/media/platform/rcar_fdp1.c +0 -4
@@ -1439,8 +1439,6 @@ static void fdp1_compute_stride(struct v4l2_pix_format_mplane *pix, pix->plane_fmt[i].sizeimage = pix->plane_fmt[i].bytesperline * pix->height / vsub; -memset (pix->plane_fmt[i].reserved,0 , -sizeof (pix->plane_fmt[i].reserved)); }if (fmt->num_planes ==3 ) {
@@ -1448,8 +1446,6 @@ static void fdp1_compute_stride(struct v4l2_pix_format_mplane *pix, pix->plane_fmt[2 ].bytesperline = pix->plane_fmt[1 ].bytesperline; pix->plane_fmt[2 ].sizeimage = pix->plane_fmt[1 ].sizeimage; -memset (pix->plane_fmt[2 ].reserved,0 , -sizeof (pix->plane_fmt[2 ].reserved)); } }
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7-goog
Re: [PATCH 4/9] media: fdp1: Do not zero reserved fields
Hi Ricardo,
Quoted 6 lines · Ricardo Ribalda
Core code already clears reserved fields of struct
v4l2_pix_format_mplane, check:4e1e0eb0e074("media: v4l2-ioctl: Zerov4l2_plane_pix_formatreserved fields").Signed-off-by Ricardo Ribalda <[email protected]>
I love a good cleanup series.
Quoted 27 lines
--- drivers/media/platform/rcar_fdp1.c | 4 ---- 1 file changed, 4 deletions(-)drivers/media/platform/rcar_fdp1.c +0
-4@@ -1439,8 +1439,6 @@ static void fdp1_compute_stride(struct v4l2_pix_format_mplane *pix, pix->plane_fmt[i].sizeimage = pix->plane_fmt[i].bytesperline * pix->height / vsub; -memset (pix->plane_fmt[i].reserved,0 , -sizeof (pix->plane_fmt[i].reserved)); }if (fmt->num_planes ==3 ) {@@ -1448,8 +1446,6 @@ static void fdp1_compute_stride(struct v4l2_pix_format_mplane *pix, pix->plane_fmt[2 ].bytesperline = pix->plane_fmt[1 ].bytesperline; pix->plane_fmt[2 ].sizeimage = pix->plane_fmt[1 ].sizeimage; -memset (pix->plane_fmt[2 ].reserved,0 , -sizeof (pix->plane_fmt[2 ].reserved)); } }
PATCH 5/9 media: jpu: Do not zero reserved fields
In reply to Ricardo RibaldaCore code already clears reserved fields of struct v4l2_pix_format_mplane, check: 4e1e0eb0e074 ("media: v4l2-ioctl: Zero v4l2_plane_pix_format reserved fields").
--- drivers/media/platform/rcar_jpu.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/media/platform/rcar_jpu.c +0 -5
@@ -793,7 +793,6 @@ static int __jpu_try_fmt(struct jpu_ctx *ctx, struct jpu_fmt **fmtinfo, pix->colorspace = fmt->colorspace; pix->field =V4L2_FIELD_NONE ; pix->num_planes = fmt->num_planes; -memset (pix->reserved,0 ,sizeof (pix->reserved)); jpu_bound_align_image(&pix->width, JPU_WIDTH_MIN, JPU_WIDTH_MAX, fmt->h_align, &pix->height, JPU_HEIGHT_MIN,
@@ -808,8 +807,6 @@ static int __jpu_try_fmt(struct jpu_ctx *ctx, struct jpu_fmt **fmtinfo, pix->plane_fmt[0 ].sizeimage =JPU_JPEG_HDR_SIZE + (JPU_JPEG_MAX_BYTES_PER_PIXEL * w * h); pix->plane_fmt[0 ].bytesperline =0 ; -memset (pix->plane_fmt[0 ].reserved,0 , -sizeof (pix->plane_fmt[0 ].reserved)); }else {unsigned int i, bpl =0 ;
@@ -822,8 +819,6 @@ static int __jpu_try_fmt(struct jpu_ctx *ctx, struct jpu_fmt **fmtinfo,for (i =0 ; i < pix->num_planes; ++i) { pix->plane_fmt[i].bytesperline = bpl; pix->plane_fmt[i].sizeimage = bpl * h * fmt->bpp[i] /8 ; -memset (pix->plane_fmt[i].reserved,0 , -sizeof (pix->plane_fmt[i].reserved)); } }
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7-goog
Re: [PATCH 5/9] media: jpu: Do not zero reserved fields
Hi Ricardo,
drivers/media/platform/rcar_jpu.c
Quoted 14 lines · Ricardo Ribalda
Core code already clears reserved fields of struct
v4l2_pix_format_mplane, check:4e1e0eb0e074("media: v4l2-ioctl: Zerov4l2_plane_pix_formatreserved fields").Cc Mikhail Ulyanov <[email protected]>Signed-off-by Ricardo Ribalda <[email protected]>--- drivers/media/platform/rcar_jpu.c | 5 ----- 1 file changed, 5 deletions(-)drivers/media/platform/rcar_jpu.c +0
-0
There's a memset(cap->reserved...) in jpu_querycap()
Is that also applicable and covered by the core?
Looking at v4l_querycap() it doesn't seem to be so:
Quoted 27 lines
drivers/media/platform/rcar_jpu.c +0
-5@@ -793,7 +793,6 @@ static int __jpu_try_fmt(struct jpu_ctx *ctx, struct jpu_fmt **fmtinfo, pix->colorspace = fmt->colorspace; pix->field =V4L2_FIELD_NONE ; pix->num_planes = fmt->num_planes; -memset (pix->reserved,0 ,sizeof (pix->reserved)); jpu_bound_align_image(&pix->width, JPU_WIDTH_MIN, JPU_WIDTH_MAX, fmt->h_align, &pix->height, JPU_HEIGHT_MIN,@@ -808,8 +807,6 @@ static int __jpu_try_fmt(struct jpu_ctx *ctx, struct jpu_fmt **fmtinfo, pix->plane_fmt[0 ].sizeimage =JPU_JPEG_HDR_SIZE + (JPU_JPEG_MAX_BYTES_PER_PIXEL * w * h); pix->plane_fmt[0 ].bytesperline =0 ; -memset (pix->plane_fmt[0 ].reserved,0 , -sizeof (pix->plane_fmt[0 ].reserved)); }else {unsigned int i, bpl =0 ;@@ -822,8 +819,6 @@ static int __jpu_try_fmt(struct jpu_ctx *ctx, struct jpu_fmt **fmtinfo,for (i =0 ; i < pix->num_planes; ++i) { pix->plane_fmt[i].bytesperline = bpl; pix->plane_fmt[i].sizeimage = bpl * h * fmt->bpp[i] /8 ; -memset (pix->plane_fmt[i].reserved,0 , -sizeof (pix->plane_fmt[i].reserved)); } }
Re: [PATCH 5/9] media: jpu: Do not zero reserved fields
Quoted 13 lines · Kieran Bingham
Hi Ricardo,
Quoted 10 lines · Ricardo Ribalda
Core code already clears reserved fields of struct
v4l2_pix_format_mplane, check:4e1e0eb0e074("media: v4l2-ioctl: Zerov4l2_plane_pix_formatreserved fields").Cc Mikhail Ulyanov <[email protected]>Signed-off-by Ricardo Ribalda <[email protected]>--- drivers/media/platform/rcar_jpu.c | 5 ----- 1 file changed, 5 deletions(-)
Quoted 8 lines
drivers/media/platform/rcar_jpu.c
Quoted 4 lines
drivers/media/platform/rcar_jpu.c +0
-0There's a
memset(cap->reserved...)injpu_querycap()Is that also applicable and covered by the core?
Yes: VIDIOC_QUERYCAP is a read-only ioctl: the core will always zero the struct in that case before handing it over to the driver.
This is something for a separate patch, though. There may well be more drivers that do this for querycap.
Regards,
Hans
Quoted 34 lines
Looking at
v4l_querycap()it doesn't seem to be so:Reviewed-by Kieran Bingham <[email protected]>Quoted 27 lines
drivers/media/platform/rcar_jpu.c +0
-5@@ -793,7 +793,6 @@ static int __jpu_try_fmt(struct jpu_ctx *ctx, struct jpu_fmt **fmtinfo, pix->colorspace = fmt->colorspace; pix->field =V4L2_FIELD_NONE ; pix->num_planes = fmt->num_planes; -memset (pix->reserved,0 ,sizeof (pix->reserved)); jpu_bound_align_image(&pix->width, JPU_WIDTH_MIN, JPU_WIDTH_MAX, fmt->h_align, &pix->height, JPU_HEIGHT_MIN,@@ -808,8 +807,6 @@ static int __jpu_try_fmt(struct jpu_ctx *ctx, struct jpu_fmt **fmtinfo, pix->plane_fmt[0 ].sizeimage =JPU_JPEG_HDR_SIZE + (JPU_JPEG_MAX_BYTES_PER_PIXEL * w * h); pix->plane_fmt[0 ].bytesperline =0 ; -memset (pix->plane_fmt[0 ].reserved,0 , -sizeof (pix->plane_fmt[0 ].reserved)); }else {unsigned int i, bpl =0 ;@@ -822,8 +819,6 @@ static int __jpu_try_fmt(struct jpu_ctx *ctx, struct jpu_fmt **fmtinfo,for (i =0 ; i < pix->num_planes; ++i) { pix->plane_fmt[i].bytesperline = bpl; pix->plane_fmt[i].sizeimage = bpl * h * fmt->bpp[i] /8 ; -memset (pix->plane_fmt[i].reserved,0 , -sizeof (pix->plane_fmt[i].reserved)); } }
PATCH 6/9 media: sum4i-csi: Do not zero reserved fields
In reply to Ricardo RibaldaCore code already clears reserved fields of struct v4l2_pix_format_mplane, check: 4e1e0eb0e074 ("media: v4l2-ioctl: Zero v4l2_plane_pix_format reserved fields").
--- drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c +0 -4
@@ -113,8 +113,6 @@ static void _sun4i_csi_try_fmt(struct sun4i_csi *csi, pix->num_planes = _fmt->num_planes; pix->pixelformat = _fmt->fourcc; -memset (pix->reserved,0 ,sizeof (pix->reserved)); -/* Align the width and height on the subsampling */ width =ALIGN (pix->width, _fmt->hsub); height =ALIGN (pix->height, _fmt->vsub);
@@ -131,8 +129,6 @@ static void _sun4i_csi_try_fmt(struct sun4i_csi *csi, bpl = pix->width / hsub * _fmt->bpp[i] /8 ; pix->plane_fmt[i].bytesperline = bpl; pix->plane_fmt[i].sizeimage = bpl * pix->height / vsub; -memset (pix->plane_fmt[i].reserved,0 , -sizeof (pix->plane_fmt[i].reserved)); } }
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7-goog
Re: [PATCH 6/9] media: sum4i-csi: Do not zero reserved fields
Hi Ricardo,
Thanks a lot for doing this media-wide cleanup.
Aside from a silly typo here in the commit title, s/sum4i-csi/sun4i-csi, all the patches seem fine.
Thanks,
Ezequiel
Quoted 37 lines · Ricardo Ribalda
Core code already clears reserved fields of struct
v4l2_pix_format_mplane, check:4e1e0eb0e074("media: v4l2-ioctl: Zerov4l2_plane_pix_formatreserved fields").Cc Maxime Ripard <[email protected]>Cc Chen-Yu Tsai <[email protected]>Signed-off-by Ricardo Ribalda <[email protected]>--- drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c | 4 ---- 1 file changed, 4 deletions(-)drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c +0
-5@@ -113,8 +113,6 @@ static void _sun4i_csi_try_fmt(struct sun4i_csi *csi, pix->num_planes = _fmt->num_planes; pix->pixelformat = _fmt->fourcc; -memset (pix->reserved,0 ,sizeof (pix->reserved)); -/* Align the width and height on the subsampling */ width =ALIGN (pix->width, _fmt->hsub); height =ALIGN (pix->height, _fmt->vsub);@@ -131,8 +129,6 @@ static void _sun4i_csi_try_fmt(struct sun4i_csi *csi, bpl = pix->width / hsub * _fmt->bpp[i] /8 ; pix->plane_fmt[i].bytesperline = bpl; pix->plane_fmt[i].sizeimage = bpl * pix->height / vsub; -memset (pix->plane_fmt[i].reserved,0 , -sizeof (pix->plane_fmt[i].reserved)); } } --2.30.0.284.gd98b1dd5eaa7-goog
Re: [PATCH 6/9] media: sum4i-csi: Do not zero reserved fields
In reply to Ricardo RibaldaHi Ricardo,
Well I've started, so I may as well finish and do the rest too.
Quoted 3 lines · Ricardo Ribalda
Core code already clears reserved fields of struct
v4l2_pix_format_mplane, check:4e1e0eb0e074("media: v4l2-ioctl: Zerov4l2_plane_pix_formatreserved fields").
Indeed, these are the only memsets here ...
With the $TITLE fixed as spotted by Ezequiel,
Quoted 31 lines
Cc Maxime Ripard <[email protected]>Cc Chen-Yu Tsai <[email protected]>Signed-off-by Ricardo Ribalda <[email protected]>--- drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c | 4 ---- 1 file changed, 4 deletions(-)drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c +0
-4@@ -113,8 +113,6 @@ static void _sun4i_csi_try_fmt(struct sun4i_csi *csi, pix->num_planes = _fmt->num_planes; pix->pixelformat = _fmt->fourcc; -memset (pix->reserved,0 ,sizeof (pix->reserved)); -/* Align the width and height on the subsampling */ width =ALIGN (pix->width, _fmt->hsub); height =ALIGN (pix->height, _fmt->vsub);@@ -131,8 +129,6 @@ static void _sun4i_csi_try_fmt(struct sun4i_csi *csi, bpl = pix->width / hsub * _fmt->bpp[i] /8 ; pix->plane_fmt[i].bytesperline = bpl; pix->plane_fmt[i].sizeimage = bpl * pix->height / vsub; -memset (pix->plane_fmt[i].reserved,0 , -sizeof (pix->plane_fmt[i].reserved)); } }
PATCH 7/9 media: ti-vpe: Do not zero reserved fields
In reply to Ricardo RibaldaCore code already clears reserved fields of struct v4l2_pix_format_mplane, check: 4e1e0eb0e074 ("media: v4l2-ioctl: Zero v4l2_plane_pix_format reserved fields").
--- drivers/media/platform/ti-vpe/vpe.c | 2 -- 1 file changed, 2 deletions(-)
drivers/media/platform/ti-vpe/vpe.c +0 -2
@@ -1683,7 +1683,6 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f, } } -memset (pix->reserved,0 ,sizeof (pix->reserved));for (i =0 ; i < pix->num_planes; i++) { plane_fmt = &pix->plane_fmt[i]; depth = fmt->vpdma_fmt[i]->depth;
@@ -1713,7 +1712,6 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f, plane_fmt->bytesperline * depth) >> 3; } -memset (plane_fmt->reserved,0 ,sizeof (plane_fmt->reserved)); }return 0 ;
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7-goog
Re: [PATCH 7/9] media: ti-vpe: Do not zero reserved fields
Hi Ricardo,
Quoted 3 lines · Ricardo Ribalda
Core code already clears reserved fields of struct
v4l2_pix_format_mplane, check:4e1e0eb0e074("media: v4l2-ioctl: Zerov4l2_plane_pix_formatreserved fields").
Quoted 27 lines
Cc Benoit Parrot <[email protected]>Signed-off-by Ricardo Ribalda <[email protected]>--- drivers/media/platform/ti-vpe/vpe.c | 2 -- 1 file changed, 2 deletions(-)drivers/media/platform/ti-vpe/vpe.c +0
-2@@ -1683,7 +1683,6 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f, } } -memset (pix->reserved,0 ,sizeof (pix->reserved));for (i =0 ; i < pix->num_planes; i++) { plane_fmt = &pix->plane_fmt[i]; depth = fmt->vpdma_fmt[i]->depth;@@ -1713,7 +1712,6 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f, plane_fmt->bytesperline * depth) >> 3; } -memset (plane_fmt->reserved,0 ,sizeof (plane_fmt->reserved)); }return 0 ;
PATCH 8/9 media: vicodec: Do not zero reserved fields
In reply to Ricardo RibaldaCore code already clears reserved fields of struct v4l2_pix_format_mplane, check: 4e1e0eb0e074 ("media: v4l2-ioctl: Zero v4l2_plane_pix_format reserved fields").
--- drivers/media/test-drivers/vicodec/vicodec-core.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/media/test-drivers/vicodec/vicodec-core.c +0 -5
@@ -811,9 +811,6 @@ static int vidioc_g_fmt(struct vicodec_ctx *ctx, struct v4l2_format *f) pix_mp->xfer_func = ctx->state.xfer_func; pix_mp->ycbcr_enc = ctx->state.ycbcr_enc; pix_mp->quantization = ctx->state.quantization; -memset (pix_mp->reserved,0 ,sizeof (pix_mp->reserved)); -memset (pix_mp->plane_fmt[0 ].reserved,0 , -sizeof (pix_mp->plane_fmt[0 ].reserved));break ;default :return -EINVAL ;
@@ -886,8 +883,6 @@ static int vidioc_try_fmt(struct vicodec_ctx *ctx, struct v4l2_format *f) info->sizeimage_mult / info->sizeimage_div;if (pix_mp->pixelformat ==V4L2_PIX_FMT_FWHT ) plane->sizeimage +=sizeof (struct fwht_cframe_hdr ); -memset (pix_mp->reserved,0 ,sizeof (pix_mp->reserved)); -memset (plane->reserved,0 ,sizeof (plane->reserved));break ;default :return -EINVAL ;
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7-goog
Re: [PATCH 8/9] media: vicodec: Do not zero reserved fields
Hi Ricardo,
Quoted 6 lines · Ricardo Ribalda
Core code already clears reserved fields of struct
v4l2_pix_format_mplane, check:4e1e0eb0e074("media: v4l2-ioctl: Zerov4l2_plane_pix_formatreserved fields").Cc Hans Verkuil <[email protected]>Signed-off-by Ricardo Ribalda <[email protected]>
Quoted 28 lines
--- drivers/media/test-drivers/vicodec/vicodec-core.c | 5 ----- 1 file changed, 5 deletions(-)drivers/media/test-drivers/vicodec/vicodec-core.c +0
-5@@ -811,9 +811,6 @@ static int vidioc_g_fmt(struct vicodec_ctx *ctx, struct v4l2_format *f) pix_mp->xfer_func = ctx->state.xfer_func; pix_mp->ycbcr_enc = ctx->state.ycbcr_enc; pix_mp->quantization = ctx->state.quantization; -memset (pix_mp->reserved,0 ,sizeof (pix_mp->reserved)); -memset (pix_mp->plane_fmt[0 ].reserved,0 , -sizeof (pix_mp->plane_fmt[0 ].reserved));break ;default :return -EINVAL ;@@ -886,8 +883,6 @@ static int vidioc_try_fmt(struct vicodec_ctx *ctx, struct v4l2_format *f) info->sizeimage_mult / info->sizeimage_div;if (pix_mp->pixelformat ==V4L2_PIX_FMT_FWHT ) plane->sizeimage +=sizeof (struct fwht_cframe_hdr ); -memset (pix_mp->reserved,0 ,sizeof (pix_mp->reserved)); -memset (plane->reserved,0 ,sizeof (plane->reserved));break ;default :return -EINVAL ;
PATCH 9/9 media: staging/intel-ipu3 : Do not zero reserved fields
In reply to Ricardo RibaldaCore code already clears reserved fields of struct v4l2_pix_format_mplane, check: 4e1e0eb0e074 ("media: v4l2-ioctl: Zero v4l2_plane_pix_format reserved fields").
--- drivers/staging/media/ipu3/ipu3-v4l2.c | 3 --- 1 file changed, 3 deletions(-)
drivers/staging/media/ipu3/ipu3-v4l2.c +0 -3
@@ -773,9 +773,6 @@ static int imgu_try_fmt(struct file *file, void *fh, struct v4l2_format *f) pixm->pixelformat = fmt->fourcc; -memset (pixm->plane_fmt[0 ].reserved,0 , -sizeof (pixm->plane_fmt[0 ].reserved)); -return 0 ; }
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7-goog
Re: [PATCH 9/9] media: staging/intel-ipu3 : Do not zero reserved fields
Hi Ricardo,
drivers/staging/media/ipu3/ipu3-v4l2.c
Quoted 14 lines · Ricardo Ribalda
Core code already clears reserved fields of struct
v4l2_pix_format_mplane, check:4e1e0eb0e074("media: v4l2-ioctl: Zerov4l2_plane_pix_formatreserved fields").Cc Sakari Ailus <[email protected]>Signed-off-by Ricardo Ribalda <[email protected]>--- drivers/staging/media/ipu3/ipu3-v4l2.c | 3 --- 1 file changed, 3 deletions(-)drivers/staging/media/ipu3/ipu3-v4l2.c +0
-0
The ipu3-css.c also has a memset on the plane formats in the migu_css_queue_init(), but that's possibly still out of scope for this patch ('just')
struct v4l2_pix_format_mplane *const f = &queue->fmt.mpix;
memset(f->reserved, 0, sizeof(f->reserved));I can't yet see anything that clears the reserved formats on queue initialisations, so I don't think we can remove that yet unless I've missed something anyway.
Seems like there is a lot more that could be cleared in core ...
But - as I said, I think that's out of scope here so
Quoted 11 lines
drivers/staging/media/ipu3/ipu3-v4l2.c +0
-3@@ -773,9 +773,6 @@ static int imgu_try_fmt(struct file *file, void *fh, struct v4l2_format *f) pixm->pixelformat = fmt->fourcc; -memset (pixm->plane_fmt[0 ].reserved,0 , -sizeof (pixm->plane_fmt[0 ].reserved)); -return 0 ; }
Hi Ricardo,
Quoted 6 lines · Ricardo Ribalda
Core code already clears reserved fields of struct
v4l2_pix_format_mplane, check:4e1e0eb0e074("media: v4l2-ioctl: Zerov4l2_plane_pix_formatreserved fields").Cc Sakari Ailus <[email protected]>Signed-off-by Ricardo Ribalda <[email protected]>
Quoted 22 lines
--- drivers/media/pci/intel/ipu3/ipu3-cio2.c | 3 --- 1 file changed, 3 deletions(-)drivers/media/pci/intel/ipu3/ipu3-cio2.c +0
-3@@ -1094,12 +1094,9 @@ static int cio2_v4l2_try_fmt(struct file *file, void *fh, struct v4l2_format *f) mpix->pixelformat = fmt->fourcc; mpix->colorspace =V4L2_COLORSPACE_RAW ; mpix->field =V4L2_FIELD_NONE ; -memset (mpix->reserved,0 ,sizeof (mpix->reserved)); mpix->plane_fmt[0 ].bytesperline =cio2_bytesperline (mpix->width); mpix->plane_fmt[0 ].sizeimage = mpix->plane_fmt[0 ].bytesperline * mpix->height; -memset (mpix->plane_fmt[0 ].reserved,0 , -sizeof (mpix->plane_fmt[0 ].reserved));/* use default */ mpix->ycbcr_enc =V4L2_YCBCR_ENC_DEFAULT ;