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

Commit 67ddc9c3 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "staging: android: ion: Validate hyp assign number of elements"

parents 3d534c18 17ec0b84
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -103,6 +103,13 @@ int ion_hyp_unassign_sg(struct sg_table *sgt, int *source_vm_list,
	struct scatterlist *sg;
	int ret, i;

	if (source_nelems <= 0) {
		pr_err("%s: source_nelems invalid\n",
		       __func__);
		ret = -EINVAL;
		goto out;
	}

	ret = hyp_assign_table(sgt, source_vm_list, source_nelems,
			       &dest_vmid, &dest_perms, 1);
	if (ret) {
@@ -126,6 +133,13 @@ int ion_hyp_assign_sg(struct sg_table *sgt, int *dest_vm_list,
	int i;
	int ret = 0;

	if (dest_nelems <= 0) {
		pr_err("%s: dest_nelems invalid\n",
		       __func__);
		ret = -EINVAL;
		goto out;
	}

	dest_perms = kcalloc(dest_nelems, sizeof(*dest_perms), GFP_KERNEL);
	if (!dest_perms) {
		ret = -ENOMEM;