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: <20200226145900.GL5023@valkosipuli.retiisi.org.uk>
Date:   Wed, 26 Feb 2020 16:59:00 +0200
From:   Sakari Ailus <sakari.ailus@....fi>
To:     Eugen Hristev <eugen.hristev@...rochip.com>
Cc:     linux-media@...r.kernel.org, hverkuil@...all.nl,
        laurent.pinchart@...asonboard.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: v4l2-core: fix entity initialization in
 device_register_subdev

Hi Eugen,

On Wed, Feb 26, 2020 at 02:15:45PM +0200, Eugen Hristev wrote:
> The check for parameters is done below in the function.
> Initialize the entity variable properly, after the parameters
> have been checked.
> 
> Fixes: 61f5db549dde ("[media] v4l: Make v4l2_subdev inherit from media_entity")
> Signed-off-by: Eugen Hristev <eugen.hristev@...rochip.com>
> ---
>  drivers/media/v4l2-core/v4l2-device.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c
> index 63d6b147b21e..6e33132ebb19 100644
> --- a/drivers/media/v4l2-core/v4l2-device.c
> +++ b/drivers/media/v4l2-core/v4l2-device.c
> @@ -112,7 +112,7 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
>  				struct v4l2_subdev *sd)
>  {
>  #if defined(CONFIG_MEDIA_CONTROLLER)
> -	struct media_entity *entity = &sd->entity;
> +	struct media_entity *entity;
>  #endif
>  	int err;
>  
> @@ -141,6 +141,7 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
>  		goto error_module;
>  
>  #if defined(CONFIG_MEDIA_CONTROLLER)
> +	entity = &sd->entity;
>  	/* Register the entity. */
>  	if (v4l2_dev->mdev) {
>  		err = media_device_register_entity(v4l2_dev->mdev, entity);

Thanks for the patch.

Instead of keeping a shorthand for entity locally, I'd just refer to
&sd->entity. It's more simple, and gets away with one pair of #if / #endif
as well.

-- 
Regards,

Sakari Ailus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ