linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: bugzilla-daemon@bugzilla.kernel.org
To: linuxppc-dev@lists.ozlabs.org
Subject: [Bug 206695] kmemleak reports leaks in drivers/macintosh/windfarm
Date: Thu, 05 Mar 2020 12:22:51 +0000	[thread overview]
Message-ID: <bug-206695-206035-aIyJTSKaE1@https.bugzilla.kernel.org/> (raw)
In-Reply-To: <bug-206695-206035@https.bugzilla.kernel.org/>

https://bugzilla.kernel.org/show_bug.cgi?id=206695

--- Comment #3 from mpe@ellerman.id.au ---
Can you try this patch?

diff --git a/drivers/macintosh/windfarm_pm112.c
b/drivers/macintosh/windfarm_pm112.c
index 4150301a89a5..a16f43a1def9 100644
--- a/drivers/macintosh/windfarm_pm112.c
+++ b/drivers/macintosh/windfarm_pm112.c
@@ -125,7 +125,7 @@ static int create_cpu_loop(int cpu)
 {
        int chip = cpu / 2;
        int core = cpu & 1;
-       struct smu_sdbp_header *hdr;
+       struct smu_sdbp_header *hdr, *hdr2;
        struct smu_sdbp_cpupiddata *piddata;
        struct wf_cpu_pid_param pid;
        struct wf_control *main_fan = cpu_fans[0];
@@ -141,9 +141,9 @@ static int create_cpu_loop(int cpu)
        piddata = (struct smu_sdbp_cpupiddata *)&hdr[1];

        /* Get FVT params to get Tmax; if not found, assume default */
-       hdr = smu_sat_get_sdb_partition(chip, 0xC4 + core, NULL);
-       if (hdr) {
-               struct smu_sdbp_fvt *fvt = (struct smu_sdbp_fvt *)&hdr[1];
+       hdr2 = smu_sat_get_sdb_partition(chip, 0xC4 + core, NULL);
+       if (hdr2) {
+               struct smu_sdbp_fvt *fvt = (struct smu_sdbp_fvt *)&hdr2[1];
                tmax = fvt->maxtemp << 16;
        } else
                tmax = 95 << 16;        /* default to 95 degrees C */
@@ -174,6 +174,10 @@ static int create_cpu_loop(int cpu)
                pid.min = fmin;

        wf_cpu_pid_init(&cpu_pid[cpu], &pid);
+
+       kfree(hdr);
+       kfree(hdr2);
+
        return 0;
 }

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

  parent reply	other threads:[~2020-03-05 12:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27 23:44 [Bug 206695] New: kmemleak reports leaks in drivers/macintosh/windfarm bugzilla-daemon
2020-02-27 23:45 ` [Bug 206695] " bugzilla-daemon
2020-02-27 23:45 ` bugzilla-daemon
2020-03-05 12:22 ` [Bug 206695] New: " Michael Ellerman
2020-03-05 12:22 ` bugzilla-daemon [this message]
2020-03-05 22:09 ` [Bug 206695] " bugzilla-daemon
2020-03-06  0:01   ` Michael Ellerman
2020-03-06  0:01 ` bugzilla-daemon
2020-03-06  9:54 ` bugzilla-daemon
2020-04-23  6:53 ` bugzilla-daemon
2020-04-23  6:54 ` bugzilla-daemon
2020-04-24  0:30 ` bugzilla-daemon
2020-04-26 22:05 ` bugzilla-daemon

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=bug-206695-206035-aIyJTSKaE1@https.bugzilla.kernel.org/ \
    --to=bugzilla-daemon@bugzilla.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.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).