On Wed, Dec 04, 2013 at 06:09:35PM +0000, Serban Constantinescu wrote:Command is 32bit for both arches but does not have the same value. Here is what happens, this patch make more sense when looking at the compat layer.This patch modifies the functions that need to be passed the explicit
command to use a boolean flag. This way we can reuse the code for 64bit
compat commands.
I don't understand this at all. cmd seems like it should be 32 bits
on both arches.
BR_INCREFS = _IOR('r', 7, struct binder_ptr_cookie)
COMPAT_BR_INCREFS = _IOR('r', 7, struct compat_binder_ptr_cookie)
struct compat_binder_ptr_cookie {
compat_uptr_t ptr;
compat_uptr_t cookie;
};
struct binder_ptr_cookie {
void *ptr;
void *cookie;
};
case BC_INCREFS_DONE:
case BC_ACQUIRE_DONE: {
void __user *node_ptr;
void *cookie;
if (get_user(node_ptr, (void * __user *)ptr))
return -EFAULT;
ptr += sizeof(void *);
if (get_user(cookie, (void * __user *)ptr))
return -EFAULT;
ptr += sizeof(void *);
bc_increfs_done(proc, thread, cmd == BC_ACQUIRE_DONE, node_ptr, cookie);
break;
}
+ case COMPAT_BC_INCREFS_DONE:
+ case COMPAT_BC_ACQUIRE_DONE: {
+ compat_uptr_t node_ptr;
+ compat_uptr_t cookie;
+
+ if (get_user(node_ptr, (compat_uptr_t __user *)*ptr))
+ return -EFAULT;
+ *ptr += sizeof(compat_uptr_t);
+ if (get_user(cookie, (compat_uptr_t __user *)*ptr))
+ return -EFAULT;
+ *ptr += sizeof(compat_uptr_t);
+ bc_increfs_done(proc, thread, cmd == COMPAT_BC_ACQUIRE_DONE,
+ compat_ptr(node_ptr), compat_ptr(cookie));
+ break;
static void bc_increfs_done(struct binder_proc *proc,
- struct binder_thread *thread, uint32_t cmd,
+ struct binder_thread *thread, bool acquire,