lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ac655c582609b7887381e1b68ed99f6b128fd794.camel@ndufresne.ca>
Date: Fri, 30 May 2025 13:33:58 -0400
From: Nicolas Dufresne <nicolas@...fresne.ca>
To: Kyrie Wu <kyrie.wu@...iatek.com>, Hans Verkuil
 <hverkuil-cisco@...all.nl>,  Mauro Carvalho Chehab	 <mchehab@...nel.org>,
 Rob Herring <robh@...nel.org>, Krzysztof Kozlowski	 <krzk+dt@...nel.org>,
 Conor Dooley <conor+dt@...nel.org>, Matthias Brugger	
 <matthias.bgg@...il.com>, AngeloGioacchino Del Regno	
 <angelogioacchino.delregno@...labora.com>, linux-media@...r.kernel.org, 
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-arm-kernel@...ts.infradead.org, linux-mediatek@...ts.infradead.org
Cc: srv_heupstream@...iatek.com
Subject: Re: [PATCH v5 06/12] media: mediatek: jpeg: refactor jpeg buffer
 payload setting

Hi Kyrie,

Le vendredi 30 mai 2025 à 15:45 +0800, Kyrie Wu a écrit :
> 1. for multi-core jpegdec:
>    core0: |<-------- decoding buffer0 and resolution changed to smaller
>    core1:  |<-------- decoding buffer1
>    core0:   |<- handling resolution changing
>    core0:    |<- vb2_set_plane_payload
> 2. the payload size is changed on the step of set format. Because core1
> is running and streaming has not been stopped, the format cannot be
> set again, resulting in no change in the payload size.
> 3. at this time, the payload size is bigger than buffer length,
> it will print a warnning call trace
> 4. set payload size must less than buffer length

You'll have to rework the text in this commit message, I must admit I don't
understand from this text what exactly the problem is, make it really hard to
review your solution.

> 
> Signed-off-by: Kyrie Wu <kyrie.wu@...iatek.com>
> ---
>  .../platform/mediatek/jpeg/mtk_jpeg_core.c     | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> index 0074d1edb534..52d59bb5c9ad 100644
> --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> @@ -720,10 +720,22 @@ static int mtk_jpeg_buf_prepare(struct vb2_buffer *vb)
>  		plane_fmt = q_data->pix_mp.plane_fmt[i];
>  		if (ctx->enable_exif &&
>  		    q_data->fmt->fourcc == V4L2_PIX_FMT_JPEG)
> -			vb2_set_plane_payload(vb, i, plane_fmt.sizeimage +
> -					      MTK_JPEG_MAX_EXIF_SIZE);
> +			if (vb->planes[i].length > (plane_fmt.sizeimage +
> +			    MTK_JPEG_MAX_EXIF_SIZE))
> +				vb2_set_plane_payload(vb, i,
> +						      plane_fmt.sizeimage +
> +						      MTK_JPEG_MAX_EXIF_SIZE);
> +			else
> +				vb2_set_plane_payload(vb, i,
> +						      vb->planes[i].length);
> +
>  		else
> -			vb2_set_plane_payload(vb, i,  plane_fmt.sizeimage);
> +			if (vb->planes[i].length > plane_fmt.sizeimage)
> +				vb2_set_plane_payload(vb, i,
> +						      plane_fmt.sizeimage);
> +			else
> +				vb2_set_plane_payload(vb, i,
> +						      vb->planes[i].length);

Is this the same as ?

		unsigned long max_size = plane_fmt.sizeimage;

		if (ctx->enable_exif && q_data->fmt->fourcc == V4L2_PIX_FMT_JPEG)
			max_size += MTK_JPEG_MAX_EXIF_SIZE;

		vb2_set_plane_payload(vb, i, MIN(vb->planes[i].length, max_size));

It is unclear to me how this isn't just a workaround though, looking forward
your reworked commit message.

Nicolas

>  	}
>  
>  	return 0;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ