[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190716.123723.2173742343657007091.davem@davemloft.net>
Date: Tue, 16 Jul 2019 12:37:23 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: nishkadg.linux@...il.com
Cc: grygorii.strashko@...com, ivan.khoronzhuk@...aro.org,
linux-omap@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH] net: ethernet: ti: cpsw: Add of_node_put() before
return and break
From: Nishka Dasgupta <nishkadg.linux@...il.com>
Date: Tue, 16 Jul 2019 11:18:43 +0530
> Each iteration of for_each_available_child_of_node puts the previous
> node, but in the case of a return or break from the middle of the loop,
> there is no put, thus causing a memory leak.
What an incredible terribly designed loop macro, this
for_each_available_child_of_node () thing is.
A macro with non-trivial, invisible, side effects. It requires
special handling of reference counting of objects if the loop is
terminated early.
This is so error prone. Is it any wonder we have to go through the
entire tree fixing up nearly every use of this thing?
Instead of looking at the automated analysis of this and saying "great
here are all of these places where I can fix bugs", I would instead
appreicate it if the reaction was more like "this interface is
obviously impossible to use in a non-error-prone fashion, we should
fix it."
I guess I have no choice but to apply your fixes, but the larger issue
must be addressed instead.
Powered by blists - more mailing lists