Commit 397334fc authored by Serban Constantinescu's avatar Serban Constantinescu Committed by Greg Kroah-Hartman

staging: android: binder: modify struct binder_write_read to use size_t

This change mirrors the userspace operation where struct binder_write_read
members that specify the buffer size and consumed size are size_t elements.

The patch also fixes the binder_thread_write() and binder_thread_read()
functions prototypes to conform with the definition of binder_write_read.

The changes do not affect existing 32bit ABI.
Signed-off-by: default avatarSerban Constantinescu <serban.constantinescu@arm.com>
Acked-by: default avatarArve Hjønnevåg <arve@android.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ba628ad0
...@@ -1701,7 +1701,7 @@ static void binder_transaction(struct binder_proc *proc, ...@@ -1701,7 +1701,7 @@ static void binder_transaction(struct binder_proc *proc,
} }
int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread, int binder_thread_write(struct binder_proc *proc, struct binder_thread *thread,
void __user *buffer, int size, signed long *consumed) void __user *buffer, size_t size, size_t *consumed)
{ {
uint32_t cmd; uint32_t cmd;
void __user *ptr = buffer + *consumed; void __user *ptr = buffer + *consumed;
...@@ -2081,8 +2081,8 @@ static int binder_has_thread_work(struct binder_thread *thread) ...@@ -2081,8 +2081,8 @@ static int binder_has_thread_work(struct binder_thread *thread)
static int binder_thread_read(struct binder_proc *proc, static int binder_thread_read(struct binder_proc *proc,
struct binder_thread *thread, struct binder_thread *thread,
void __user *buffer, int size, void __user *buffer, size_t size,
signed long *consumed, int non_block) size_t *consumed, int non_block)
{ {
void __user *ptr = buffer + *consumed; void __user *ptr = buffer + *consumed;
void __user *end = buffer + size; void __user *end = buffer + size;
...@@ -2579,7 +2579,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -2579,7 +2579,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
goto err; goto err;
} }
binder_debug(BINDER_DEBUG_READ_WRITE, binder_debug(BINDER_DEBUG_READ_WRITE,
"%d:%d write %ld at %08lx, read %ld at %08lx\n", "%d:%d write %zd at %08lx, read %zd at %08lx\n",
proc->pid, thread->pid, bwr.write_size, proc->pid, thread->pid, bwr.write_size,
bwr.write_buffer, bwr.read_size, bwr.read_buffer); bwr.write_buffer, bwr.read_size, bwr.read_buffer);
...@@ -2605,7 +2605,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -2605,7 +2605,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
} }
} }
binder_debug(BINDER_DEBUG_READ_WRITE, binder_debug(BINDER_DEBUG_READ_WRITE,
"%d:%d wrote %ld of %ld, read return %ld of %ld\n", "%d:%d wrote %zd of %zd, read return %zd of %zd\n",
proc->pid, thread->pid, bwr.write_consumed, bwr.write_size, proc->pid, thread->pid, bwr.write_consumed, bwr.write_size,
bwr.read_consumed, bwr.read_size); bwr.read_consumed, bwr.read_size);
if (copy_to_user(ubuf, &bwr, sizeof(bwr))) { if (copy_to_user(ubuf, &bwr, sizeof(bwr))) {
......
...@@ -67,11 +67,11 @@ struct flat_binder_object { ...@@ -67,11 +67,11 @@ struct flat_binder_object {
*/ */
struct binder_write_read { struct binder_write_read {
signed long write_size; /* bytes to write */ size_t write_size; /* bytes to write */
signed long write_consumed; /* bytes consumed by driver */ size_t write_consumed; /* bytes consumed by driver */
unsigned long write_buffer; unsigned long write_buffer;
signed long read_size; /* bytes to read */ size_t read_size; /* bytes to read */
signed long read_consumed; /* bytes consumed by driver */ size_t read_consumed; /* bytes consumed by driver */
unsigned long read_buffer; unsigned long read_buffer;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment