kernel-hacking-2024-linux-s.../arch/powerpc
Julia Lawall 7cf9bac559 powerpc/chrp/nvram.c: Add of_node_put to avoid memory leak
Add a call to of_node_put in the error handling code following a call to
of_find_node_by_type.

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>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2010-09-02 14:07:34 +10:00
..
boot Merge remote branch 'jwb/merge' into merge 2010-08-24 14:36:45 +10:00
configs powerpc: Trim defconfigs 2010-08-09 11:19:16 +10:00
include/asm powerpc/dma: Add optional platform override of dma_set_mask() 2010-09-02 14:07:32 +10:00
kernel powerpc/dma: Add optional platform override of dma_set_mask() 2010-09-02 14:07:32 +10:00
kvm powerpc: Remove fpscr use from [kvm_]cvt_{fd,df} 2010-09-02 14:07:32 +10:00
lib powerpc: Abstract indexing of lppaca structs 2010-09-02 14:07:31 +10:00
math-emu
mm powerpc: Check end of stack canary at oops time 2010-09-02 14:07:30 +10:00
oprofile powerpc: Use is_32bit_task() helper to test 32-bit binary 2010-09-02 14:07:32 +10:00
platforms powerpc/chrp/nvram.c: Add of_node_put to avoid memory leak 2010-09-02 14:07:34 +10:00
sysdev powerpc/dart_iommu: Support for 64-bit iommu bypass window on PCIe 2010-09-02 14:07:32 +10:00
xmon Input: sysrq - drop tty argument from sysrq ops handlers 2010-08-19 22:07:06 -07:00
Kconfig Merge branch 'timers-timekeeping-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-08-06 13:18:29 -07:00
Kconfig.debug powerpc: Unconditionally enabled irq stacks 2010-06-15 15:02:37 +10:00
Makefile powerpc: Fix typo in uImage target 2010-08-24 15:26:32 +10:00
relocs_check.pl