mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] OOB read and write in mdp_prepare_buffer
@ 2023-06-27  8:27 yqsun1997
  2023-06-27 14:06 ` Alain Volmat
  2023-06-29  7:18 ` Hans Verkuil
  0 siblings, 2 replies; 7+ messages in thread
From: yqsun1997 @ 2023-06-27  8:27 UTC (permalink / raw)
  To: mchehab
  Cc: matthias.bgg, angelogioacchino.delregno, linux-media,
	linux-kernel, linux-arm-kernel, linux-mediatek, 499671216,
	yqsun1997

From: yqsun1997 <yqsun1997@gmail.com>

Because format in struct img_image_buffer max index is IMG_MAX_PLANES ==3,
The num_planes max index is 8.so will be OOB like in mdp_prepare_buffer.

static void mdp_prepare_buffer(struct img_image_buffer *b,
                               struct mdp_frame *frame, struct vb2_buffer *vb)
{
        struct v4l2_pix_format_mplane *pix_mp = &frame->format.fmt.pix_mp;
        unsigned int i;

        b->format.colorformat = frame->mdp_fmt->mdp_color;
        b->format.ycbcr_prof = frame->ycbcr_prof;
        for (i = 0; i < pix_mp->num_planes; ++i) {
                u32 stride = mdp_fmt_get_stride(frame->mdp_fmt,
                        pix_mp->plane_fmt[i].bytesperline, i);

                b->format.plane_fmt[i].stride = stride;  //oob
                ......

Signed-off-by: yqsun1997 <yqsun1997@gmail.com>
---
 drivers/media/platform/mediatek/mdp3/mtk-mdp3-type.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-type.h b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-type.h
index ae0396806..e2e991a34 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-type.h
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-type.h
@@ -11,7 +11,7 @@
 
 #define IMG_MAX_HW_INPUTS	3
 #define IMG_MAX_HW_OUTPUTS	4
-#define IMG_MAX_PLANES		3
+#define IMG_MAX_PLANES		8
 #define IMG_MAX_COMPONENTS	20
 
 struct img_crop {
-- 
2.39.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-06-29  7:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-27  8:27 [PATCH] OOB read and write in mdp_prepare_buffer yqsun1997
2023-06-27 14:06 ` Alain Volmat
2023-06-27 23:28   ` sun yq
2023-06-28  6:33     ` Alain Volmat
2023-06-28 10:09       ` sun yq
2023-06-28 15:13         ` Chen-Yu Tsai
2023-06-29  7:18 ` Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®