aboutsummaryrefslogtreecommitdiffstats
path: root/lib/devres.c
diff options
context:
space:
mode:
authorMaxin B John <maxin.john@gmail.com>2011-07-25 20:12:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-25 23:57:14 -0400
commitae891a1b93bf62e9aaa116a7a71312375047fc9f (patch)
tree83e821e818654da3e3443ecddd757665251db6e0 /lib/devres.c
parent5190f0c030f46b3169205f34f6d9ef480fa39ef2 (diff)
devres: fix possible use after free
devres uses the pointer value as key after it's freed, which is safe but triggers spurious use-after-free warnings on some static analysis tools. Rearrange code to avoid such warnings. Signed-off-by: Maxin B. John <maxin.john@gmail.com> Reviewed-by: Rolf Eike Beer <eike-kernel@sf-tec.de> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/devres.c')
-rw-r--r--lib/devres.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/devres.c b/lib/devres.c
index 6efddf53b90c..7c0e953a7486 100644
--- a/lib/devres.c
+++ b/lib/devres.c
@@ -79,9 +79,9 @@ EXPORT_SYMBOL(devm_ioremap_nocache);
79 */ 79 */
80void devm_iounmap(struct device *dev, void __iomem *addr) 80void devm_iounmap(struct device *dev, void __iomem *addr)
81{ 81{
82 iounmap(addr);
83 WARN_ON(devres_destroy(dev, devm_ioremap_release, devm_ioremap_match, 82 WARN_ON(devres_destroy(dev, devm_ioremap_release, devm_ioremap_match,
84 (void *)addr)); 83 (void *)addr));
84 iounmap(addr);
85} 85}
86EXPORT_SYMBOL(devm_iounmap); 86EXPORT_SYMBOL(devm_iounmap);
87 87