Skip to content

Commit

Permalink
drivers/watchdog/lantiq_wdt.c: drop iounmap for devm_ allocated data
Browse files Browse the repository at this point in the history
Data allocated with devm_ioremap or devm_ioremap_nocache should not be
freed using iounmap, because doing so causes a dangling pointer, and a
subsequent double free.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r@
expression x;
@@
(
 x = devm_ioremap(...)
|
 x = devm_ioremap_nocache(...)
)

@@
expression r.x;
@@
* iounmap(x)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
  • Loading branch information
Julia Lawall authored and Wim Van Sebroeck committed Jan 6, 2012
1 parent 02861cc commit 60daac4
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions drivers/watchdog/lantiq_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,6 @@ ltq_wdt_remove(struct platform_device *pdev)
{
misc_deregister(&ltq_wdt_miscdev);

if (ltq_wdt_membase)
iounmap(ltq_wdt_membase);

return 0;
}

Expand Down

0 comments on commit 60daac4

Please sign in to comment.