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] [day] [month] [year] [list]
Message-ID: <CAPY8ntCWoq6UMns04W6-BmYtCHggVr4xqZjOX1bcZtwyO-2EEg@mail.gmail.com>
Date: Tue, 11 Jun 2024 16:18:53 +0100
From: Dave Stevenson <dave.stevenson@...pberrypi.com>
To: Abdulrasaq Lawani <abdulrasaqolawani@...il.com>
Cc: sakari.ailus@...ux.intel.com, jacopo@...ndi.org, mchehab@...nel.org, 
	julia.lawall@...ia.fr, linux-media@...r.kernel.org, 
	linux-kernel@...r.kernel.org, skhan@...uxfoundation.org, 
	javier.carrasco.cruz@...il.com
Subject: Re: [PATCH] media: i2c: replacing of_node_put with __free(device_node)

Hi

Thanks for the patch.

The subject should be "media: i2c: ov5647:" or just "media: ov5647" as
you're only touching the one driver.

On Fri, 10 May 2024 at 11:11, Abdulrasaq Lawani
<abdulrasaqolawani@...il.com> wrote:
>
> Replaced instance of of_node_put with __free(device_node)
> to protect against any memory leaks due to future changes
> in control flow.
>
> Suggested-by: Julia Lawall <julia.lawall@...ia.fr>
> Signed-off-by: Abdulrasaq Lawani <abdulrasaqolawani@...il.com>
> ---
>  drivers/media/i2c/ov5647.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c
> index 7e1ecdf2485f..d593dba092e3 100644
> --- a/drivers/media/i2c/ov5647.c
> +++ b/drivers/media/i2c/ov5647.c
> @@ -1360,23 +1360,19 @@ static int ov5647_parse_dt(struct ov5647 *sensor, struct device_node *np)
>         struct v4l2_fwnode_endpoint bus_cfg = {
>                 .bus_type = V4L2_MBUS_CSI2_DPHY,
>         };
> -       struct device_node *ep;
> +       struct device_node *ep __free(device_node) = of_graph_get_endpoint_by_regs(np, 0, -1);

The media subsystem still requests a max line length of 80.
https://github.com/torvalds/linux/blob/master/Documentation/driver-api/media/maintainer-entry-profile.rst#coding-style-addendum
Break the line after the =

>         int ret;
>
> -       ep = of_graph_get_endpoint_by_regs(np, 0, -1);
>         if (!ep)
>                 return -EINVAL;
>
>         ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), &bus_cfg);
>         if (ret)
> -               goto out;
> +               return ret;
>
>         sensor->clock_ncont = bus_cfg.bus.mipi_csi2.flags &
>                               V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK;
>
> -out:
> -       of_node_put(ep);
> -
>         return ret;

This could be "return 0;" as you've already returned if it was non-zero.

I know very little of this new mechanism, but it looks reasonable, and
Sakari has given it a basic blessing in a previous patch set.
With the above 3 comments addressed:
Acked-by: Dave Stevenson <dave.stevenson@...pberrypi.com>

>  }

>
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ