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]
Date: Thu, 23 May 2024 23:31:40 +0530
From: prabhav kumar <pvkumar5749404@...il.com>
To: Michael Ellerman <mpe@...erman.id.au>
Cc: akpm@...ux-foundation.org, npiggin@...il.com, christophe.leroy@...roup.eu, 
	naveen.n.rao@...ux.ibm.com, linuxppc-dev@...ts.ozlabs.org, 
	linux-kernel@...r.kernel.org, skhan@...uxfoundation.org, 
	julia.lawall@...ia.fr, javier.carrasco.cruz@...il.com
Subject: Re: [PATCH next] arch: powerpc: platforms: Remove unnecessary call to of_node_get

On Thu, May 23, 2024 at 4:55 PM Michael Ellerman <mpe@...erman.id.au> wrote:
>
> Prabhav Kumar Vaish <pvkumar5749404@...il.com> writes:
> > `dev->of_node` has a pointer to device node, of_node_get call seems
> > unnecessary.
>
> Sorry but it is necessary.
>
> > Signed-off-by: Prabhav Kumar Vaish <pvkumar5749404@...il.com>
> > ---
> >  arch/powerpc/platforms/cell/iommu.c | 9 +++------
> >  1 file changed, 3 insertions(+), 6 deletions(-)
> >
> > diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
> > index 4cd9c0de22c2..5b794ce08689 100644
> > --- a/arch/powerpc/platforms/cell/iommu.c
> > +++ b/arch/powerpc/platforms/cell/iommu.c
> > @@ -780,14 +780,13 @@ static int __init cell_iommu_init_disabled(void)
> >  static u64 cell_iommu_get_fixed_address(struct device *dev)
> >  {
> >       u64 cpu_addr, size, best_size, dev_addr = OF_BAD_ADDR;
> > -     struct device_node *np;
> > +     struct device_node *np = dev->of_node;
> >       const u32 *ranges = NULL;
> >       int i, len, best, naddr, nsize, pna, range_size;
> >
> >       /* We can be called for platform devices that have no of_node */
> > -     np = of_node_get(dev->of_node);
> >       if (!np)
> > -             goto out;
> > +             return dev_addr;
> >
> >       while (1) {
> >               naddr = of_n_addr_cells(np);
>
>                 nsize = of_n_size_cells(np);
>                 np = of_get_next_parent(np);
>                 if (!np)
>                         break;
>
> of_get_next_parent() drops the reference of the node passed to it (np).
>
> So if you actually tested your patch you should see a recount underflow.
>
Thanks, I will check this out once again
Prabhav
> cheers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ