summaryrefslogtreecommitdiffstats
path: root/lib/devres.c
diff options
context:
space:
mode:
authorMaxin B John <maxin.john@gmail.com>2011-07-25 17:12:59 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-25 20:57:14 -0700
commitae891a1b93bf62e9aaa116a7a71312375047fc9f (patch)
tree83e821e818654da3e3443ecddd757665251db6e0 /lib/devres.c
parent5190f0c030f46b3169205f34f6d9ef480fa39ef2 (diff)
downloadop-kernel-dev-ae891a1b93bf62e9aaa116a7a71312375047fc9f.zip
op-kernel-dev-ae891a1b93bf62e9aaa116a7a71312375047fc9f.tar.gz
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 6efddf5..7c0e953 100644
--- a/lib/devres.c
+++ b/lib/devres.c
@@ -79,9 +79,9 @@ EXPORT_SYMBOL(devm_ioremap_nocache);
*/
void devm_iounmap(struct device *dev, void __iomem *addr)
{
- iounmap(addr);
WARN_ON(devres_destroy(dev, devm_ioremap_release, devm_ioremap_match,
(void *)addr));
+ iounmap(addr);
}
EXPORT_SYMBOL(devm_iounmap);
OpenPOWER on IntegriCloud