mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: rp1-cfe: Use IS_ERR() check for media_entity_remote_source_pad_unique()
@ 2026-05-14 19:31 Ingyu Jang
  2026-05-22 10:14 ` Dave Stevenson
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ingyu Jang @ 2026-05-14 19:31 UTC (permalink / raw)
  To: Tomi Valkeinen, Raspberry Pi Kernel Maintenance,
	Mauro Carvalho Chehab, Florian Fainelli
  Cc: Broadcom internal kernel review list, linux-media,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel

media_entity_remote_source_pad_unique() returns either a valid struct
media_pad pointer or an error pointer (ERR_PTR(-ENOTUNIQ) or
ERR_PTR(-ENOLINK)); it never returns NULL. The current NULL check
therefore never triggers, and the "pad not connected" error path is
unreachable.

Replace the NULL check with an IS_ERR() check so the validation
actually detects malformed media graphs.

Signed-off-by: Ingyu Jang <ingyujang25@korea.ac.kr>
---
 drivers/media/platform/raspberrypi/rp1-cfe/cfe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c b/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
index 8375ed3e97b9f..91e9fa0341e06 100644
--- a/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
+++ b/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
@@ -1779,7 +1779,7 @@ static int cfe_video_link_validate(struct media_link *link)
 		link->source->entity->name, link->source->index,
 		link->sink->entity->name, link->sink->index);
 
-	if (!media_entity_remote_source_pad_unique(link->sink->entity)) {
+	if (IS_ERR(media_entity_remote_source_pad_unique(link->sink->entity))) {
 		cfe_err(cfe, "video node %s pad not connected\n", vd->name);
 		return -ENOTCONN;
 	}
-- 
2.34.1


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

* Re: [PATCH] media: rp1-cfe: Use IS_ERR() check for media_entity_remote_source_pad_unique()
  2026-05-14 19:31 [PATCH] media: rp1-cfe: Use IS_ERR() check for media_entity_remote_source_pad_unique() Ingyu Jang
@ 2026-05-22 10:14 ` Dave Stevenson
  2026-06-03  6:41 ` Jai Luthra
  2026-11-01 13:24 ` [PATCH v2] " Ingyu Jang
  2 siblings, 0 replies; 5+ messages in thread
From: Dave Stevenson @ 2026-05-22 10:14 UTC (permalink / raw)
  To: Ingyu Jang
  Cc: Tomi Valkeinen, Raspberry Pi Kernel Maintenance,
	Mauro Carvalho Chehab, Florian Fainelli,
	Broadcom internal kernel review list, linux-media,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel

On Thu, 14 May 2026 at 20:32, Ingyu Jang <ingyujang25@korea.ac.kr> wrote:
>
> * Spam *
> media_entity_remote_source_pad_unique() returns either a valid struct
> media_pad pointer or an error pointer (ERR_PTR(-ENOTUNIQ) or
> ERR_PTR(-ENOLINK)); it never returns NULL. The current NULL check
> therefore never triggers, and the "pad not connected" error path is
> unreachable.
>
> Replace the NULL check with an IS_ERR() check so the validation
> actually detects malformed media graphs.
>
> Signed-off-by: Ingyu Jang <ingyujang25@korea.ac.kr>

Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>

> ---
>  drivers/media/platform/raspberrypi/rp1-cfe/cfe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c b/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
> index 8375ed3e97b9f..91e9fa0341e06 100644
> --- a/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
> +++ b/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
> @@ -1779,7 +1779,7 @@ static int cfe_video_link_validate(struct media_link *link)
>                 link->source->entity->name, link->source->index,
>                 link->sink->entity->name, link->sink->index);
>
> -       if (!media_entity_remote_source_pad_unique(link->sink->entity)) {
> +       if (IS_ERR(media_entity_remote_source_pad_unique(link->sink->entity))) {
>                 cfe_err(cfe, "video node %s pad not connected\n", vd->name);
>                 return -ENOTCONN;
>         }
> --
> 2.34.1
>
>

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

* Re: [PATCH] media: rp1-cfe: Use IS_ERR() check for media_entity_remote_source_pad_unique()
  2026-05-14 19:31 [PATCH] media: rp1-cfe: Use IS_ERR() check for media_entity_remote_source_pad_unique() Ingyu Jang
  2026-05-22 10:14 ` Dave Stevenson
@ 2026-06-03  6:41 ` Jai Luthra
  2026-11-01 13:24 ` [PATCH v2] " Ingyu Jang
  2 siblings, 0 replies; 5+ messages in thread
From: Jai Luthra @ 2026-06-03  6:41 UTC (permalink / raw)
  To: Florian Fainelli, Ingyu Jang, Mauro Carvalho Chehab,
	Raspberry Pi Kernel Maintenance, Tomi Valkeinen
  Cc: Broadcom internal kernel review list, linux-media,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel

Hi Ingyu,

Quoting Ingyu Jang (2026-05-15 01:01:48)
> media_entity_remote_source_pad_unique() returns either a valid struct
> media_pad pointer or an error pointer (ERR_PTR(-ENOTUNIQ) or
> ERR_PTR(-ENOLINK)); it never returns NULL. The current NULL check
> therefore never triggers, and the "pad not connected" error path is
> unreachable.
> 
> Replace the NULL check with an IS_ERR() check so the validation
> actually detects malformed media graphs.
> 
> Signed-off-by: Ingyu Jang <ingyujang25@korea.ac.kr>

Needs fixes and Cc to stable,

Fixes: 6edb685abb2a ("media: raspberrypi: Add support for RP1-CFE")
Cc: stable@vger.kernel.org 

With that,

Reviewed-by: Jai Luthra <jai.luthra@ideasonboard.com>

Thanks,
    Jai

> ---
>  drivers/media/platform/raspberrypi/rp1-cfe/cfe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c b/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
> index 8375ed3e97b9f..91e9fa0341e06 100644
> --- a/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
> +++ b/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
> @@ -1779,7 +1779,7 @@ static int cfe_video_link_validate(struct media_link *link)
>                 link->source->entity->name, link->source->index,
>                 link->sink->entity->name, link->sink->index);
>  
> -       if (!media_entity_remote_source_pad_unique(link->sink->entity)) {
> +       if (IS_ERR(media_entity_remote_source_pad_unique(link->sink->entity))) {
>                 cfe_err(cfe, "video node %s pad not connected\n", vd->name);
>                 return -ENOTCONN;
>         }
> -- 
> 2.34.1
> 
>

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

* [PATCH v2] media: rp1-cfe: Use IS_ERR() check for media_entity_remote_source_pad_unique()
  2026-05-14 19:31 [PATCH] media: rp1-cfe: Use IS_ERR() check for media_entity_remote_source_pad_unique() Ingyu Jang
  2026-05-22 10:14 ` Dave Stevenson
  2026-06-03  6:41 ` Jai Luthra
@ 2026-11-01 13:24 ` Ingyu Jang
  2026-11-02 11:32   ` Tomi Valkeinen
  2 siblings, 1 reply; 5+ messages in thread
From: Ingyu Jang @ 2026-11-01 13:24 UTC (permalink / raw)
  To: Tomi Valkeinen, Raspberry Pi Kernel Maintenance,
	Mauro Carvalho Chehab, Florian Fainelli
  Cc: Dave Stevenson, Jai Luthra, Sakari Ailus, Naushir Patuck,
	Broadcom internal kernel review list, linux-media,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel, Ingyu Jang,
	stable

media_entity_remote_source_pad_unique() returns either a valid struct
media_pad pointer or an error pointer (ERR_PTR(-ENOTUNIQ) or
ERR_PTR(-ENOLINK)); it never returns NULL. The current NULL check
therefore never triggers, and the "pad not connected" error path is
unreachable.

Replace the NULL check with an IS_ERR() check so the validation
actually detects malformed media graphs.

Fixes: 6edb685abb2a ("media: raspberrypi: Add support for RP1-CFE")
Cc: stable@vger.kernel.org
Signed-off-by: Ingyu Jang <ingyujang25@korea.ac.kr>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Jai Luthra <jai.luthra@ideasonboard.com>
---
Changes in v2:
- Add Fixes: and Cc: stable tags, as requested by Jai Luthra.
- Collect Reviewed-by tags from Dave Stevenson and Jai Luthra.
- Diff unchanged.

Link to v1: https://lore.kernel.org/all/20260514193148.2357371-1-ingyujang25@korea.ac.kr/

 drivers/media/platform/raspberrypi/rp1-cfe/cfe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c b/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
index 8375ed3e97b9f..91e9fa0341e06 100644
--- a/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
+++ b/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c
@@ -1779,7 +1779,7 @@ static int cfe_video_link_validate(struct media_link *link)
 		link->source->entity->name, link->source->index,
 		link->sink->entity->name, link->sink->index);
 
-	if (!media_entity_remote_source_pad_unique(link->sink->entity)) {
+	if (IS_ERR(media_entity_remote_source_pad_unique(link->sink->entity))) {
 		cfe_err(cfe, "video node %s pad not connected\n", vd->name);
 		return -ENOTCONN;
 	}
-- 
2.34.1


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

* Re: [PATCH v2] media: rp1-cfe: Use IS_ERR() check for media_entity_remote_source_pad_unique()
  2026-11-01 13:24 ` [PATCH v2] " Ingyu Jang
@ 2026-11-02 11:32   ` Tomi Valkeinen
  0 siblings, 0 replies; 5+ messages in thread
From: Tomi Valkeinen @ 2026-11-02 11:32 UTC (permalink / raw)
  To: Ingyu Jang, Raspberry Pi Kernel Maintenance,
	Mauro Carvalho Chehab, Florian Fainelli
  Cc: Dave Stevenson, Jai Luthra, Sakari Ailus, Naushir Patuck,
	Broadcom internal kernel review list, linux-media,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel, stable

Hi,

On 01/11/2026 15:24, Ingyu Jang wrote:
> media_entity_remote_source_pad_unique() returns either a valid struct
> media_pad pointer or an error pointer (ERR_PTR(-ENOTUNIQ) or
> ERR_PTR(-ENOLINK)); it never returns NULL. The current NULL check
> therefore never triggers, and the "pad not connected" error path is
> unreachable.
> 
> Replace the NULL check with an IS_ERR() check so the validation
> actually detects malformed media graphs.
> 
> Fixes: 6edb685abb2a ("media: raspberrypi: Add support for RP1-CFE")
> Cc: stable@vger.kernel.org
> Signed-off-by: Ingyu Jang <ingyujang25@korea.ac.kr>
> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> Reviewed-by: Jai Luthra <jai.luthra@ideasonboard.com>

Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

  Tomi


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

end of thread, other threads:[~2026-11-02 11:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-14 19:31 [PATCH] media: rp1-cfe: Use IS_ERR() check for media_entity_remote_source_pad_unique() Ingyu Jang
2026-05-22 10:14 ` Dave Stevenson
2026-06-03  6:41 ` Jai Luthra
2026-11-01 13:24 ` [PATCH v2] " Ingyu Jang
2026-11-02 11:32   ` Tomi Valkeinen

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®