Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dc89f797 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Joerg Roedel
Browse files

iommu/shmobile: Allocate archdata with kzalloc()



The archdata attached_list field isn't initialized, leading to random
crashes when accessed. Use kzalloc() to allocate the whole structure and
make sure all fields get initialized properly.

Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: default avatarJoerg Roedel <joro@8bytes.org>
parent 78a2e12f
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -380,14 +380,13 @@ int ipmmu_iommu_init(struct shmobile_ipmmu *ipmmu)
		kmem_cache_destroy(l1cache);
		return -ENOMEM;
	}
	archdata = kmalloc(sizeof(*archdata), GFP_KERNEL);
	archdata = kzalloc(sizeof(*archdata), GFP_KERNEL);
	if (!archdata) {
		kmem_cache_destroy(l1cache);
		kmem_cache_destroy(l2cache);
		return -ENOMEM;
	}
	spin_lock_init(&archdata->attach_lock);
	archdata->attached = NULL;
	archdata->ipmmu = ipmmu;
	ipmmu_archdata = archdata;
	bus_set_iommu(&platform_bus_type, &shmobile_iommu_ops);