* [PATCH] sparc: pci: Fix memory leak in pci_bus_slot_names()
@ 2025-02-20 21:00 Salah Triki
0 siblings, 0 replies; 4+ messages in thread
From: Salah Triki @ 2025-02-20 21:00 UTC (permalink / raw)
To: David S. Miller, Andreas Larsson, sparclinux, linux-kernel; +Cc: Salah Triki
prop is a local pointer in pci_bus_slot_names(). It is initialized
by calling of_get_property() so the caller must free prop when done
using it.
Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
arch/sparc/kernel/pci.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index ddac216a2aff..fa0da8f45723 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -971,6 +971,8 @@ static void pci_bus_slot_names(struct device_node *node, struct pci_bus *bus)
mask &= ~this_bit;
i++;
}
+
+ kfree(prop);
}
static int __init of_pci_slot_init(void)
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] sparc: pci: Fix memory leak in pci_bus_slot_names()
@ 2025-04-07 11:06 Salah Triki
2025-04-07 19:49 ` Christophe JAILLET
0 siblings, 1 reply; 4+ messages in thread
From: Salah Triki @ 2025-04-07 11:06 UTC (permalink / raw)
To: David S. Miller, Andreas Larsson, sparclinux, linux-kernel; +Cc: salah.triki
prop is a local pointer in pci_bus_slot_names(). It is initialized
by calling of_get_property() so the caller must free prop when done
using it.
Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
arch/sparc/kernel/pci.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index ddac216a2aff..fa0da8f45723 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -971,6 +971,8 @@ static void pci_bus_slot_names(struct device_node *node, struct pci_bus *bus)
mask &= ~this_bit;
i++;
}
+
+ kfree(prop);
}
static int __init of_pci_slot_init(void)
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] sparc: pci: Fix memory leak in pci_bus_slot_names()
2025-04-07 11:06 [PATCH] sparc: pci: Fix memory leak in pci_bus_slot_names() Salah Triki
@ 2025-04-07 19:49 ` Christophe JAILLET
2025-04-09 12:51 ` Salah Triki
0 siblings, 1 reply; 4+ messages in thread
From: Christophe JAILLET @ 2025-04-07 19:49 UTC (permalink / raw)
To: Salah Triki, David S. Miller, Andreas Larsson, sparclinux,
linux-kernel
Le 07/04/2025 à 13:06, Salah Triki a écrit :
> prop is a local pointer in pci_bus_slot_names(). It is initialized
> by calling of_get_property() so the caller must free prop when done
> using it.
Hi,
can you elaborate why?
It does not look needed to me, and the places using of_get_property()
that I've checked don't have such a kfree().
CJ
>
> Signed-off-by: Salah Triki <salah.triki@gmail.com>
> ---
> arch/sparc/kernel/pci.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
> index ddac216a2aff..fa0da8f45723 100644
> --- a/arch/sparc/kernel/pci.c
> +++ b/arch/sparc/kernel/pci.c
> @@ -971,6 +971,8 @@ static void pci_bus_slot_names(struct device_node *node, struct pci_bus *bus)
> mask &= ~this_bit;
> i++;
> }
> +
> + kfree(prop);
> }
>
> static int __init of_pci_slot_init(void)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sparc: pci: Fix memory leak in pci_bus_slot_names()
2025-04-07 19:49 ` Christophe JAILLET
@ 2025-04-09 12:51 ` Salah Triki
0 siblings, 0 replies; 4+ messages in thread
From: Salah Triki @ 2025-04-09 12:51 UTC (permalink / raw)
To: Christophe JAILLET
Cc: David S. Miller, Andreas Larsson, sparclinux, linux-kernel
On Mon, Apr 07, 2025 at 09:49:08PM +0200, Christophe JAILLET wrote:
> Le 07/04/2025 à 13:06, Salah Triki a écrit :
> > prop is a local pointer in pci_bus_slot_names(). It is initialized
> > by calling of_get_property() so the caller must free prop when done
> > using it.
>
> Hi,
>
> can you elaborate why?
>
> It does not look needed to me, and the places using of_get_property() that
> I've checked don't have such a kfree().
>
> CJ
Hi,
Sorry for disturbing, I was wrong about that.
ST
>
> >
> > Signed-off-by: Salah Triki <salah.triki@gmail.com>
> > ---
> > arch/sparc/kernel/pci.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
> > index ddac216a2aff..fa0da8f45723 100644
> > --- a/arch/sparc/kernel/pci.c
> > +++ b/arch/sparc/kernel/pci.c
> > @@ -971,6 +971,8 @@ static void pci_bus_slot_names(struct device_node *node, struct pci_bus *bus)
> > mask &= ~this_bit;
> > i++;
> > }
> > +
> > + kfree(prop);
> > }
> > static int __init of_pci_slot_init(void)
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-09 12:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07 11:06 [PATCH] sparc: pci: Fix memory leak in pci_bus_slot_names() Salah Triki
2025-04-07 19:49 ` Christophe JAILLET
2025-04-09 12:51 ` Salah Triki
-- strict thread matches above, loose matches on Subject: below --
2025-02-20 21:00 Salah Triki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).