* [PATCH] net: dsa: add missing of_node_put
@ 2019-02-20 3:24 Himadri Pandya
2019-02-20 3:53 ` [Outreachy kernel] " Vaishali Thakkar
2019-02-20 14:46 ` Andrew Lunn
0 siblings, 2 replies; 4+ messages in thread
From: Himadri Pandya @ 2019-02-20 3:24 UTC (permalink / raw)
To: outreachy-kernel
Cc: julia.lawall, andrew, f.fainelli, davem, netdev, linux-kernel,
Himadri Pandya
Decrement the reference count on port while returning out of the loop.
Signed-off-by: Himadri Pandya <himadri18.07@gmail.com>
---
net/dsa/dsa2.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index a1917025e155..396e7433dd8f 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -624,19 +624,25 @@ static int dsa_switch_parse_ports_of(struct dsa_switch *ds,
for_each_available_child_of_node(ports, port) {
err = of_property_read_u32(port, "reg", ®);
if (err)
- return err;
+ goto put_port;
- if (reg >= ds->num_ports)
- return -EINVAL;
+ if (reg >= ds->num_ports) {
+ err = -EINVAL;
+ goto put_port;
+ }
dp = &ds->ports[reg];
err = dsa_port_parse_of(dp, port);
if (err)
- return err;
+ goto put_port;
}
return 0;
+
+put_port:
+ of_node_put(port);
+ return err;
}
static int dsa_switch_parse_member_of(struct dsa_switch *ds,
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [Outreachy kernel] [PATCH] net: dsa: add missing of_node_put
2019-02-20 3:24 [PATCH] net: dsa: add missing of_node_put Himadri Pandya
@ 2019-02-20 3:53 ` Vaishali Thakkar
2019-02-20 9:10 ` Himadri Pandya
2019-02-20 14:46 ` Andrew Lunn
1 sibling, 1 reply; 4+ messages in thread
From: Vaishali Thakkar @ 2019-02-20 3:53 UTC (permalink / raw)
To: Himadri Pandya
Cc: outreachy-kernel, Julia Lawall, andrew, Florian Fainelli,
David S. Miller, netdev, Linux Kernel Mailing List
On Wed, Feb 20, 2019 at 8:54 AM Himadri Pandya <himadri18.07@gmail.com> wrote:
>
Hi Himadri,
Thanks for the patch!
For the scope of Outreachy, we prefer that you send patches in staging
directory as Greg makes sure to pick them during the application
period. Of course, you're very much encouraged to contribute to other
subsystems as well but there patches are mainly picked up based on
maintainer's cycle which may or may not be picked up for linux-next when
selection of interns happens.
I hope that makes sense.
> Decrement the reference count on port while returning out of the loop.
How did you find out about this issue? I think it would be good to
give credit to tool in commit log if the issue is identified or produced
by tool. [In this case, I assume it's Coccinelle]
> Signed-off-by: Himadri Pandya <himadri18.07@gmail.com>
> ---
> net/dsa/dsa2.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
> index a1917025e155..396e7433dd8f 100644
> --- a/net/dsa/dsa2.c
> +++ b/net/dsa/dsa2.c
> @@ -624,19 +624,25 @@ static int dsa_switch_parse_ports_of(struct dsa_switch *ds,
> for_each_available_child_of_node(ports, port) {
> err = of_property_read_u32(port, "reg", ®);
> if (err)
> - return err;
> + goto put_port;
>
> - if (reg >= ds->num_ports)
> - return -EINVAL;
> + if (reg >= ds->num_ports) {
> + err = -EINVAL;
> + goto put_port;
> + }
>
> dp = &ds->ports[reg];
>
> err = dsa_port_parse_of(dp, port);
> if (err)
> - return err;
> + goto put_port;
> }
>
> return 0;
> +
> +put_port:
> + of_node_put(port);
> + return err;
> }
>
> static int dsa_switch_parse_member_of(struct dsa_switch *ds,
> --
> 2.17.1
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190220032432.2878-1-himadri18.07%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [Outreachy kernel] [PATCH] net: dsa: add missing of_node_put
2019-02-20 3:53 ` [Outreachy kernel] " Vaishali Thakkar
@ 2019-02-20 9:10 ` Himadri Pandya
0 siblings, 0 replies; 4+ messages in thread
From: Himadri Pandya @ 2019-02-20 9:10 UTC (permalink / raw)
To: Vaishali Thakkar
Cc: outreachy-kernel, Julia Lawall, andrew, Florian Fainelli,
David S. Miller, netdev, Linux Kernel Mailing List
On 20/02/19 9:23 AM, Vaishali Thakkar wrote:
> On Wed, Feb 20, 2019 at 8:54 AM Himadri Pandya <himadri18.07@gmail.com> wrote:
> Hi Himadri,
>
> Thanks for the patch!
>
> For the scope of Outreachy, we prefer that you send patches in staging
> directory as Greg makes sure to pick them during the application
> period. Of course, you're very much encouraged to contribute to other
> subsystems as well but there patches are mainly picked up based on
> maintainer's cycle which may or may not be picked up for linux-next when
> selection of interns happens.
>
> I hope that makes sense.
Understood. Thank you for letting me know that.
>> Decrement the reference count on port while returning out of the loop.
> How did you find out about this issue?
I believe that Julia Lawall has been working on this for a while. After
doing some cleanup patches, I'm trying to continue the work with her help.
> I think it would be good to
> give credit to tool in commit log if the issue is identified or produced
> by tool. [In this case, I assume it's Coccinelle]
Yes, it was identified by Coccinelle and I should include it in the
commit message. Thank you for the remark. I'll revise the patch accordingly.
- Himadri
>> Signed-off-by: Himadri Pandya <himadri18.07@gmail.com>
>> ---
>> net/dsa/dsa2.c | 14 ++++++++++----
>> 1 file changed, 10 insertions(+), 4 deletions(-)
>>
>> diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
>> index a1917025e155..396e7433dd8f 100644
>> --- a/net/dsa/dsa2.c
>> +++ b/net/dsa/dsa2.c
>> @@ -624,19 +624,25 @@ static int dsa_switch_parse_ports_of(struct dsa_switch *ds,
>> for_each_available_child_of_node(ports, port) {
>> err = of_property_read_u32(port, "reg", ®);
>> if (err)
>> - return err;
>> + goto put_port;
>>
>> - if (reg >= ds->num_ports)
>> - return -EINVAL;
>> + if (reg >= ds->num_ports) {
>> + err = -EINVAL;
>> + goto put_port;
>> + }
>>
>> dp = &ds->ports[reg];
>>
>> err = dsa_port_parse_of(dp, port);
>> if (err)
>> - return err;
>> + goto put_port;
>> }
>>
>> return 0;
>> +
>> +put_port:
>> + of_node_put(port);
>> + return err;
>> }
>>
>> static int dsa_switch_parse_member_of(struct dsa_switch *ds,
>> --
>> 2.17.1
>>
>> --
>> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
>> To post to this group, send email to outreachy-kernel@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190220032432.2878-1-himadri18.07%40gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: dsa: add missing of_node_put
2019-02-20 3:24 [PATCH] net: dsa: add missing of_node_put Himadri Pandya
2019-02-20 3:53 ` [Outreachy kernel] " Vaishali Thakkar
@ 2019-02-20 14:46 ` Andrew Lunn
1 sibling, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2019-02-20 14:46 UTC (permalink / raw)
To: Himadri Pandya
Cc: outreachy-kernel, julia.lawall, f.fainelli, davem, netdev,
linux-kernel
On Wed, Feb 20, 2019 at 08:54:32AM +0530, Himadri Pandya wrote:
> Decrement the reference count on port while returning out of the loop.
>
> Signed-off-by: Himadri Pandya <himadri18.07@gmail.com>
Hi Himadri
Thanks for the patch. The code changes themselves look good.
Netdev has a few additional processes for submitting patches. Please
take a look at
https://www.kernel.org/doc/Documentation/networking/netdev-FAQ.txt
Please base this patch on net-next.
Thanks
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-02-20 14:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-20 3:24 [PATCH] net: dsa: add missing of_node_put Himadri Pandya
2019-02-20 3:53 ` [Outreachy kernel] " Vaishali Thakkar
2019-02-20 9:10 ` Himadri Pandya
2019-02-20 14:46 ` Andrew Lunn
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).