mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kumar Gala <galak@kernel.crashing.org>
To: Julia Lawall <julia@diku.dk>
Cc: Timur Tabi <timur@freescale.com>,
	linuxppc-dev@lists.ozlabs.org,
	devicetree-discuss@lists.ozlabs.org,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] drivers/serial/ucc_uart.c: Add of_node_put to avoid memory leak
Date: Tue, 15 Mar 2011 10:51:23 -0500	[thread overview]
Message-ID: <2452483F-04B7-4B44-B59D-94A9D18F5DA4@kernel.crashing.org> (raw)
In-Reply-To: <1283269738-14612-2-git-send-email-julia@diku.dk>


On Aug 31, 2010, at 10:48 AM, Julia Lawall wrote:

> Add a call to of_node_put in the error handling code following a call to
> of_find_compatible_node or of_find_node_by_type.
> 
> This patch also substantially reorganizes the error handling code in the
> function, to that it is possible first to jump to code that frees qe_port
> and then to jump to code that also puts np.
> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @r exists@
> local idexpression x;
> expression E,E1,E2;
> statement S;
> @@
> 
> *x = 
> (of_find_node_by_path
> |of_find_node_by_name
> |of_find_node_by_phandle
> |of_get_parent
> |of_get_next_parent
> |of_get_next_child
> |of_find_compatible_node
> |of_match_node
> |of_find_node_by_type
> |of_find_node_with_property
> |of_find_matching_node
> |of_parse_phandle
> )(...);
> ...
> if (x == NULL) S
> <... when != x = E
> *if (...) {
>  ... when != of_node_put(x)
>      when != if (...) { ... of_node_put(x); ... }
> (
>  return <+...x...+>;
> |
> *  return ...;
> )
> }
> ...>
> (
> E2 = x;
> |
> of_node_put(x);
> )
> // </smpl>
> 
> Signed-off-by: Julia Lawall <julia@diku.dk>
> 
> ---
> drivers/serial/ucc_uart.c |   67 ++++++++++++++++++++++++----------------------
> 1 file changed, 35 insertions(+), 32 deletions(-)

applied

- k

  parent reply	other threads:[~2011-03-15 15:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-31 15:48 [PATCH 0/4] " Julia Lawall
2010-08-31 15:48 ` [PATCH 1/4] drivers/serial/ucc_uart.c: " Julia Lawall
2010-09-01 18:40   ` Timur Tabi
2010-09-08 19:59   ` Grant Likely
2011-03-15 15:51   ` Kumar Gala [this message]
2010-08-31 15:48 ` [PATCH 2/4] sound/soc/fsl/p1022_ds.c: " Julia Lawall
2010-08-31 15:59   ` Mark Brown
2010-09-01 18:39   ` [alsa-devel] " Timur Tabi
2010-09-01 18:49     ` Liam Girdwood
2010-09-02 15:30   ` Mark Brown
2010-08-31 15:48 ` [PATCH 3/4] drivers/net/can/mscan/mpc5xxx_can.c: " Julia Lawall
2010-08-31 16:51   ` Wolfram Sang
2010-08-31 16:55     ` Julia Lawall
2010-08-31 17:44     ` Julia Lawall
2010-08-31 19:10       ` Wolfram Sang
2010-08-31 19:22         ` Wolfgang Grandegger
2010-09-01 17:59           ` David Miller
2010-08-31 15:48 ` [PATCH 4/4] arch/powerpc/platforms/chrp/nvram.c: " Julia Lawall
2010-09-08 20:00   ` Grant Likely

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=2452483F-04B7-4B44-B59D-94A9D18F5DA4@kernel.crashing.org \
    --to=galak@kernel.crashing.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=julia@diku.dk \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=timur@freescale.com \
    /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

all inboxes | Powered by JetHome®