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

Commit 724732b4 authored by Serban Constantinescu's avatar Serban Constantinescu Committed by Olav Haugan
Browse files

staging: android: binder: Add copy_flat_binder_object()



This patch adds copy_flat_binder_object macro() that will help
dereference struct flat_binder_object on 64bit systems where the
structure differs between 32bit and 64bit userspace.

This patch is a temporary patch that will be extended with 32bit compat
handling.

Change-Id: I94fab83332b1f69e3d38d19d84fc8beacd5d8e74
Signed-off-by: default avatarSerban Constantinescu <serban.constantinescu@arm.com>
Git-commit: 47aba82194df5b9a2b38e0e8c8f242159a6f22cf
Git-repo: git://linux-arm.org/linux-2.6-armdroid.git


Signed-off-by: default avatarOlav Haugan <ohaugan@codeaurora.org>
parent 97bd96c7
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -145,6 +145,11 @@ module_param_call(stop_on_user_error, binder_set_stop_on_user_error,
#define deref_helper(ptr)	    (*(typeof(size_t *))ptr)
#define size_helper(x)		    sizeof(x)

static inline struct flat_binder_object *copy_flat_binder_object(void __user *ptr)
{
	return (struct flat_binder_object *)ptr;
}

enum binder_stat_types {
	BINDER_STAT_PROC,
	BINDER_STAT_THREAD,
@@ -1258,7 +1263,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
			 debug_id, deref_helper(offp), buffer->data_size);
			continue;
		}
		fp = (struct flat_binder_object *)(buffer->data + deref_helper(offp));
		fp = copy_flat_binder_object(buffer->data + deref_helper(offp));
		switch (fp->type) {
		case BINDER_TYPE_BINDER:
		case BINDER_TYPE_WEAK_BINDER: {
@@ -1512,7 +1517,7 @@ static void binder_transaction(struct binder_proc *proc,
			return_error = BR_FAILED_REPLY;
			goto err_bad_offset;
		}
		fp = (struct flat_binder_object *)(t->buffer->data + deref_helper(offp));
		fp = copy_flat_binder_object(t->buffer->data + deref_helper(offp));
		switch (fp->type) {
		case BINDER_TYPE_BINDER:
		case BINDER_TYPE_WEAK_BINDER: {