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

Commit 6701c476 authored by Serban Constantinescu's avatar Serban Constantinescu Committed by Olav Haugan
Browse files

staging: android: binder: Add align_helper() macro



This patch adds align_helper() macro that will be used for enforcing
the desired alignment on 64bit systems where the alignment will differ
depending on the userspace used (32bit /64bit).

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

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


Signed-off-by: default avatarOlav Haugan <ohaugan@codeaurora.org>
parent ab24a041
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -141,6 +141,8 @@ module_param_call(stop_on_user_error, binder_set_stop_on_user_error,
			binder_stop_on_user_error = 2; \
	} while (0)

#define align_helper(ptr)	    ALIGN(ptr, sizeof(void *))

enum binder_stat_types {
	BINDER_STAT_PROC,
	BINDER_STAT_THREAD,
@@ -1240,7 +1242,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
	if (buffer->target_node)
		binder_dec_node(buffer->target_node, 1, 0);

	offp = (size_t *)(buffer->data + ALIGN(buffer->data_size, sizeof(void *)));
	offp = (size_t *)(buffer->data + align_helper(buffer->data_size));
	if (failed_at)
		off_end = failed_at;
	else
@@ -1477,7 +1479,7 @@ static void binder_transaction(struct binder_proc *proc,
	if (target_node)
		binder_inc_node(target_node, 1, 0, NULL);

	offp = (size_t *)(t->buffer->data + ALIGN(tr->data_size, sizeof(void *)));
	offp = (size_t *)(t->buffer->data + align_helper(tr->data_size));

	if (copy_from_user(t->buffer->data, tr->data.ptr.buffer, tr->data_size)) {
		binder_user_error("%d:%d got transaction with invalid data ptr\n",
@@ -2396,8 +2398,7 @@ retry:
		tr.data.ptr.buffer = (void *)t->buffer->data +
					proc->user_buffer_offset;
		tr.data.ptr.offsets = tr.data.ptr.buffer +
					ALIGN(t->buffer->data_size,
					    sizeof(void *));
					align_helper(t->buffer->data_size);

		if (binder_copy_to_user(cmd, &tr, &ptr, sizeof(struct binder_transaction_data)))
			return -EFAULT;