* [PATCH 5/7] cpufreq/pasemi: fix possible object reference leak
[not found] <1554082674-2049-1-git-send-email-wen.yang99@zte.com.cn>
@ 2019-04-01 1:37 ` Wen Yang
2019-04-03 14:23 ` [5/7] cpufreq/pasemi: Checking implementation of pas_cpufreq_cpu_init() Markus Elfring
2019-04-01 1:37 ` [PATCH 6/7] cpufreq: pmac32: fix possible object reference leak Wen Yang
1 sibling, 1 reply; 4+ messages in thread
From: Wen Yang @ 2019-04-01 1:37 UTC (permalink / raw)
To: linux-kernel
Cc: wang.yi59, linux-pm, Viresh Kumar, Rafael J. Wysocki,
linuxppc-dev, Wen Yang
The call to of_get_cpu_node returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.
Detected by coccinelle with the following warnings:
./drivers/cpufreq/pasemi-cpufreq.c:212:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 147, but without a corresponding object release within this function.
./drivers/cpufreq/pasemi-cpufreq.c:220:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 147, but without a corresponding object release within this function.
Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
drivers/cpufreq/pasemi-cpufreq.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/cpufreq/pasemi-cpufreq.c b/drivers/cpufreq/pasemi-cpufreq.c
index 75dfbd2..c7710c1 100644
--- a/drivers/cpufreq/pasemi-cpufreq.c
+++ b/drivers/cpufreq/pasemi-cpufreq.c
@@ -146,6 +146,7 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
cpu = of_get_cpu_node(policy->cpu, NULL);
+ of_node_put(cpu);
if (!cpu)
goto out;
--
2.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 6/7] cpufreq: pmac32: fix possible object reference leak
[not found] <1554082674-2049-1-git-send-email-wen.yang99@zte.com.cn>
2019-04-01 1:37 ` [PATCH 5/7] cpufreq/pasemi: fix possible object reference leak Wen Yang
@ 2019-04-01 1:37 ` Wen Yang
1 sibling, 0 replies; 4+ messages in thread
From: Wen Yang @ 2019-04-01 1:37 UTC (permalink / raw)
To: linux-kernel
Cc: wang.yi59, linux-pm, Viresh Kumar, Rafael J. Wysocki,
Paul Mackerras, linuxppc-dev, Wen Yang
The call to of_find_node_by_name returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.
Detected by coccinelle with the following warnings:
./drivers/cpufreq/pmac32-cpufreq.c:557:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 552, but without a corresponding object release within this function.
./drivers/cpufreq/pmac32-cpufreq.c:569:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 552, but without a corresponding object release within this function.
./drivers/cpufreq/pmac32-cpufreq.c:598:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 587, but without a corresponding object release within this function.
Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: linux-pm@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
---
drivers/cpufreq/pmac32-cpufreq.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c
index 52f0d91..9b4ce2e 100644
--- a/drivers/cpufreq/pmac32-cpufreq.c
+++ b/drivers/cpufreq/pmac32-cpufreq.c
@@ -552,6 +552,7 @@ static int pmac_cpufreq_init_7447A(struct device_node *cpunode)
volt_gpio_np = of_find_node_by_name(NULL, "cpu-vcore-select");
if (volt_gpio_np)
voltage_gpio = read_gpio(volt_gpio_np);
+ of_node_put(volt_gpio_np);
if (!voltage_gpio){
pr_err("missing cpu-vcore-select gpio\n");
return 1;
@@ -588,6 +589,7 @@ static int pmac_cpufreq_init_750FX(struct device_node *cpunode)
if (volt_gpio_np)
voltage_gpio = read_gpio(volt_gpio_np);
+ of_node_put(volt_gpio_np);
pvr = mfspr(SPRN_PVR);
has_cpu_l2lve = !((pvr & 0xf00) == 0x100);
--
2.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [5/7] cpufreq/pasemi: Checking implementation of pas_cpufreq_cpu_init()
2019-04-01 1:37 ` [PATCH 5/7] cpufreq/pasemi: fix possible object reference leak Wen Yang
@ 2019-04-03 14:23 ` Markus Elfring
2019-04-03 15:31 ` Dan Carpenter
0 siblings, 1 reply; 4+ messages in thread
From: Markus Elfring @ 2019-04-03 14:23 UTC (permalink / raw)
To: Wen Yang, Rafael J. Wysocki, Viresh Kumar, kernel-janitors
Cc: Yi Wang, linuxppc-dev, linux-kernel, linux-pm
> @@ -146,6 +146,7 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
>
> cpu = of_get_cpu_node(policy->cpu, NULL);
>
> + of_node_put(cpu);
> if (!cpu)
> goto out;
Can the statement “return -ENODEV” be nicer as exception handling
in the if branch of this source code place?
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/cpufreq/pasemi-cpufreq.c?id=bf97b82f37c6d90e16de001d0659644c57fa490d#n137
Regards,
Markus
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [5/7] cpufreq/pasemi: Checking implementation of pas_cpufreq_cpu_init()
2019-04-03 14:23 ` [5/7] cpufreq/pasemi: Checking implementation of pas_cpufreq_cpu_init() Markus Elfring
@ 2019-04-03 15:31 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2019-04-03 15:31 UTC (permalink / raw)
To: Markus Elfring
Cc: Yi Wang, Rafael J. Wysocki, linux-pm, Viresh Kumar,
kernel-janitors, linux-kernel, linuxppc-dev, Wen Yang
On Wed, Apr 03, 2019 at 04:23:54PM +0200, Markus Elfring wrote:
> > @@ -146,6 +146,7 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
> >
> > cpu = of_get_cpu_node(policy->cpu, NULL);
> >
> > + of_node_put(cpu);
> > if (!cpu)
> > goto out;
>
> Can the statement “return -ENODEV” be nicer as exception handling
> in the if branch of this source code place?
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/cpufreq/pasemi-cpufreq.c?id=bf97b82f37c6d90e16de001d0659644c57fa490d#n137
>
Why am I only receiving only one side of this conversation?
I don't know why you're responding to... It's not required to fix/change
unrelated style choices. If people want, they can just focus on their
own thing.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-04-03 15:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1554082674-2049-1-git-send-email-wen.yang99@zte.com.cn>
2019-04-01 1:37 ` [PATCH 5/7] cpufreq/pasemi: fix possible object reference leak Wen Yang
2019-04-03 14:23 ` [5/7] cpufreq/pasemi: Checking implementation of pas_cpufreq_cpu_init() Markus Elfring
2019-04-03 15:31 ` Dan Carpenter
2019-04-01 1:37 ` [PATCH 6/7] cpufreq: pmac32: fix possible object reference leak Wen Yang
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).