summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorAxel Haslam <axelhaslam@ti.com>2011-05-31 09:24:44 +0100
committerAndy Green <andy.green@linaro.org>2011-05-31 11:06:13 +0100
commitdbe54591cacffc8f963fce029f20734780631d01 (patch)
tree3d68800bd5900d04027deb2e6123c0e9fd8d444a /arch
parent935c208a353d1abe05b22a5f601195c12a4508ab (diff)
KW: iommu: Verify the obj validity before dereferencing
In iommu_save_tlb_entries and iommu_restore_tlb_entries moved initialization of the io table entry to after the check for the obj validity. Change-Id: I54ba196327422269f7ee64d00db707b7fedfda73 Signed-off-by: Axel Haslam <axelhaslam@ti.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/plat-omap/iommu.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c
index b1deb228243..90818cbd745 100644
--- a/arch/arm/plat-omap/iommu.c
+++ b/arch/arm/plat-omap/iommu.c
@@ -393,11 +393,12 @@ u32 iommu_save_tlb_entries(struct iommu *obj)
{
int i;
struct cr_regs cr_tmp;
- struct iotlb_entry *e = obj->tlbs_e;
+ struct iotlb_entry *e;
if (!obj || !obj->tlbs_e)
goto error;
+ e = obj->tlbs_e;
for_each_iotlb_cr(obj, obj->nr_tlb_entries, i, cr_tmp) {
iotlb_cr_to_e(&cr_tmp, e);
dev_dbg(obj->dev, "%s: %08x %08x %d %d %d", __func__, e->da,
@@ -423,11 +424,12 @@ u32 iommu_restore_tlb_entries(struct iommu *obj)
{
int i;
int status;
- struct iotlb_entry *e = obj->tlbs_e;
+ struct iotlb_entry *e;
if (!obj || !obj->tlbs_e)
goto error;
+ e = obj->tlbs_e;
for (i = 0; i < obj->nr_tlb_entries; i++) {
if (!e->prsvd) {
e++;