All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil+cisco@kernel.org>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com
Subject: Re: [PATCH 03/14] media: omap3isp: isp_video_mbus_to_pix/pix_to_mbus fixes
Date: Mon, 1 Dec 2025 16:35:23 +0100	[thread overview]
Message-ID: <ed704af1-3ec9-45a9-ac5b-c33fe9975822@kernel.org> (raw)
In-Reply-To: <aS2QkaTtBq53AGeM@kekkonen.localdomain>

On 01/12/2025 13:56, Sakari Ailus wrote:
> On Mon, Dec 01, 2025 at 12:22:12PM +0200, Sakari Ailus wrote:
>> Hi Hans,
>>
>> On Mon, Dec 01, 2025 at 09:27:55AM +0100, Hans Verkuil wrote:
>>> Hi Sakari,
>>>
>>> On 22/10/2025 09:48, Sakari Ailus wrote:
>>>> Hi Hans,
>>>>
>>>> Thanks for the set.
>>>>
>>>> On Fri, Oct 17, 2025 at 03:26:40PM +0200, Hans Verkuil wrote:
>>>>> The isp_video_mbus_to_pix/pix_to_mbus functions did not take
>>>>> the last empty entry { 0, } of the formats array into account.
>>>>>
>>>>> As a result, isp_video_mbus_to_pix would accept code 0 and
>>>>> isp_video_pix_to_mbus would select code 0 if no match was found.
>>>>>
>>>>> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
>>>>> ---
>>>>>  drivers/media/platform/ti/omap3isp/ispvideo.c | 6 +++---
>>>>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>>>>
>>>>> diff --git a/drivers/media/platform/ti/omap3isp/ispvideo.c b/drivers/media/platform/ti/omap3isp/ispvideo.c
>>>>> index 46609045e2c8..864d38140b87 100644
>>>>> --- a/drivers/media/platform/ti/omap3isp/ispvideo.c
>>>>> +++ b/drivers/media/platform/ti/omap3isp/ispvideo.c
>>>>> @@ -148,12 +148,12 @@ static unsigned int isp_video_mbus_to_pix(const struct isp_video *video,
>>>>>  	pix->width = mbus->width;
>>>>>  	pix->height = mbus->height;
>>>>>  
>>>>> -	for (i = 0; i < ARRAY_SIZE(formats); ++i) {
>>>>> +	for (i = 0; i < ARRAY_SIZE(formats) - 1; ++i) {
>>>>
>>>> As it seems all users of the formats array depend on the size of the array
>>>> and not its contents, could we remove the sentinel entry from the array
>>>> instead?
>>>
>>> Probably, but see this comment just before the sentinel in the array:
>>>
>>>         /* Empty entry to catch the unsupported pixel code (0) used by the CCDC
>>>          * module and avoid NULL pointer dereferences.
>>>          */
>>>         { 0, }
>>>
>>> Now, I wonder if this comment is out of date, since I don't see code 0 being used
>>> by CDDC. If you can confirm that that's indeed the case, then I can drop the sentinel.
>>
>> Yes, please!
> 
> Actually it's omap3isp_video_format_info() I understand ispccdc.c relies
> not to return NULL. I might add a separate variable for that, to get rid of
> this obscure arrangement.

So ispccdc.c can call omap3isp_video_format_info with a code value of 0?
Can you give an example where that happens? If true, then this feels very
fragile.

Regards,

	Hans

> 
> You could also add:
> 
> Fixes: c51364cafa26 ("[media] omap3isp: ccdc: Add YUV input formats support")
> 


  reply	other threads:[~2025-12-01 15:35 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-17 13:26 [PATCH 00/14] media: omap3isp: v4l2-compliance fixes Hans Verkuil
2025-10-17 13:26 ` [PATCH 01/14] media: omap3isp: configure entity functions Hans Verkuil
2025-10-17 13:26 ` [PATCH 02/14] media: omap3isp: add V4L2_CAP_IO_MC and don't set bus_info Hans Verkuil
2025-10-17 13:26 ` [PATCH 03/14] media: omap3isp: isp_video_mbus_to_pix/pix_to_mbus fixes Hans Verkuil
2025-10-22  7:48   ` Sakari Ailus
2025-12-01  8:27     ` Hans Verkuil
2025-12-01 10:22       ` Sakari Ailus
2025-12-01 12:56         ` Sakari Ailus
2025-12-01 15:35           ` Hans Verkuil [this message]
2025-12-01 16:43             ` Sakari Ailus
2025-12-02  7:18               ` Hans Verkuil
2025-10-17 13:26 ` [PATCH 04/14] media: omap3isp: implement enum_fmt_vid_cap/out Hans Verkuil
2025-10-22  7:56   ` Sakari Ailus
2025-12-01  8:40     ` Hans Verkuil
2025-12-01 11:35       ` Sakari Ailus
2025-12-01 13:44         ` Hans Verkuil
2025-12-01 15:27           ` Sakari Ailus
2025-10-17 13:26 ` [PATCH 05/14] media: omap3isp: use V4L2_COLORSPACE_SRGB instead of _JPEG Hans Verkuil
2025-10-17 13:26 ` [PATCH 06/14] media: omap3isp: set initial format Hans Verkuil
2025-10-17 13:26 ` [PATCH 07/14] media: omap3isp: rework isp_video_try/set_format Hans Verkuil
2025-10-22  8:04   ` Sakari Ailus
2025-12-01  8:48     ` Hans Verkuil
2025-12-01 12:42       ` Sakari Ailus
2025-10-17 13:26 ` [PATCH 08/14] media: omap3isp: implement create/prepare_bufs Hans Verkuil
2025-10-22  8:06   ` Sakari Ailus
2025-12-01  8:54     ` Hans Verkuil
2025-12-01 12:42       ` Sakari Ailus
2025-10-17 13:26 ` [PATCH 09/14] media: omap3isp: better VIDIOC_G/S_PARM handling Hans Verkuil
2025-10-22  8:09   ` Sakari Ailus
2025-12-01 10:28     ` Hans Verkuil
2025-12-01 13:40       ` Hans Verkuil
2025-12-01 15:10         ` Sakari Ailus
2025-10-17 13:26 ` [PATCH 10/14] media: omap3isp: support ctrl events for isppreview Hans Verkuil
2025-10-17 13:26 ` [PATCH 11/14] media: omap3isp: ispccp2: always clamp in ccp2_try_format() Hans Verkuil
2025-10-17 13:26 ` [PATCH 12/14] media: omap3isp: isppreview: always clamp in preview_try_format() Hans Verkuil
2025-10-17 13:26 ` [PATCH 13/14] DO NOT MERGE: media: omap3isp: change default resolution to 864x648 Hans Verkuil
2025-10-17 13:26 ` [PATCH 14/14] DO NOT MERGE: omap3-beagle-xm.dts: add Leopard Imaging li5m03 support Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ed704af1-3ec9-45a9-ac5b-c33fe9975822@kernel.org \
    --to=hverkuil+cisco@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.