sparclinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Salah Triki <salah.triki@gmail.com>
To: "David S. Miller" <davem@davemloft.net>,
	Andreas Larsson <andreas@gaisler.com>,
	sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: salah.triki@gmail.com
Subject: [PATCH] sparc: pci: Fix memory leak in pci_bus_slot_names()
Date: Mon, 7 Apr 2025 12:06:58 +0100	[thread overview]
Message-ID: <Z_Ox0qp7uuKNUo2U@pc> (raw)

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


             reply	other threads:[~2025-04-07 11:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-07 11:06 Salah Triki [this message]
2025-04-07 19:49 ` [PATCH] sparc: pci: Fix memory leak in pci_bus_slot_names() 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z_Ox0qp7uuKNUo2U@pc \
    --to=salah.triki@gmail.com \
    --cc=andreas@gaisler.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sparclinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).