Commit c127c7dc authored by Hiroshi DOYU's avatar Hiroshi DOYU Committed by Tony Lindgren

omap iommu: fix incorrect address for largepage 1st entry

There was a potential risk that the following "memset" could override
its range if a given address was not the 1st entry of a
largepage. This is not the case for "iovmm".
Reported-by: default avatarHari Nagalla <hnagalla@ti.com>
Signed-off-by: default avatarHiroshi DOYU <Hiroshi.DOYU@nokia.com>
Signed-off-by: default avatarHari Nagalla <hnagalla@ti.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 8d33ea58
/* /*
* omap iommu: tlb and pagetable primitives * omap iommu: tlb and pagetable primitives
* *
* Copyright (C) 2008-2009 Nokia Corporation * Copyright (C) 2008-2010 Nokia Corporation
* *
* Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>, * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>,
* Paul Mundt and Toshihiro Kobayashi * Paul Mundt and Toshihiro Kobayashi
...@@ -646,7 +646,7 @@ static size_t iopgtable_clear_entry_core(struct iommu *obj, u32 da) ...@@ -646,7 +646,7 @@ static size_t iopgtable_clear_entry_core(struct iommu *obj, u32 da)
if (*iopte & IOPTE_LARGE) { if (*iopte & IOPTE_LARGE) {
nent *= 16; nent *= 16;
/* rewind to the 1st entry */ /* rewind to the 1st entry */
iopte = (u32 *)((u32)iopte & IOLARGE_MASK); iopte = iopte_offset(iopgd, (da & IOLARGE_MASK));
} }
bytes *= nent; bytes *= nent;
memset(iopte, 0, nent * sizeof(*iopte)); memset(iopte, 0, nent * sizeof(*iopte));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment