* [PATCH] binder: fix "cast to pointer from integer of different size" warning
@ 2017-09-04 5:17 Jisheng Zhang
2017-09-18 14:02 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Jisheng Zhang @ 2017-09-04 5:17 UTC (permalink / raw)
To: linux-arm-kernel
The binder driver now could cause warnings as below on 32bit platforms
if ANDROID_BINDER_IPC_32BIT is unselected:
drivers/android/binder.c:1550:15: warning: cast to pointer from integer
of different size [-Wint-to-pointer-cast]
This patch fix all of them.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
drivers/android/binder.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index f7665c31feca..2812586bfae5 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -1547,7 +1547,8 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
debug_id, (u64)fda->num_fds);
continue;
}
- fd_array = (u32 *)(parent_buffer + fda->parent_offset);
+ fd_array = (u32 *)(parent_buffer +
+ (uintptr_t)fda->parent_offset);
for (fd_index = 0; fd_index < fda->num_fds; fd_index++)
task_close_fd(proc, fd_array[fd_index]);
} break;
@@ -1751,7 +1752,7 @@ static int binder_translate_fd_array(struct binder_fd_array_object *fda,
* back to the kernel address space to access it
*/
parent_buffer = parent->buffer - target_proc->user_buffer_offset;
- fd_array = (u32 *)(parent_buffer + fda->parent_offset);
+ fd_array = (u32 *)(parent_buffer + (uintptr_t)fda->parent_offset);
if (!IS_ALIGNED((unsigned long)fd_array, sizeof(u32))) {
binder_user_error("%d:%d parent offset not aligned correctly.\n",
proc->pid, thread->pid);
@@ -1786,7 +1787,7 @@ static int binder_fixup_parent(struct binder_transaction *t,
binder_size_t last_fixup_min_off)
{
struct binder_buffer_object *parent;
- u8 *parent_buffer;
+ uintptr_t parent_buffer;
struct binder_buffer *b = t->buffer;
struct binder_proc *proc = thread->proc;
struct binder_proc *target_proc = t->to_proc;
@@ -1817,9 +1818,9 @@ static int binder_fixup_parent(struct binder_transaction *t,
proc->pid, thread->pid);
return -EINVAL;
}
- parent_buffer = (u8 *)(parent->buffer -
- target_proc->user_buffer_offset);
- *(binder_uintptr_t *)(parent_buffer + bp->parent_offset) = bp->buffer;
+ parent_buffer = parent->buffer - target_proc->user_buffer_offset;
+ *(binder_uintptr_t *)(parent_buffer +
+ (uintptr_t)bp->parent_offset) = bp->buffer;
return 0;
}
--
2.14.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] binder: fix "cast to pointer from integer of different size" warning
2017-09-04 5:17 [PATCH] binder: fix "cast to pointer from integer of different size" warning Jisheng Zhang
@ 2017-09-18 14:02 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2017-09-18 14:02 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Sep 04, 2017 at 01:17:40PM +0800, Jisheng Zhang wrote:
> The binder driver now could cause warnings as below on 32bit platforms
> if ANDROID_BINDER_IPC_32BIT is unselected:
>
> drivers/android/binder.c:1550:15: warning: cast to pointer from integer
> of different size [-Wint-to-pointer-cast]
>
> This patch fix all of them.
>
> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> ---
> drivers/android/binder.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
Arnd sent in a patch for this issue right after you did, that was
smaller, so I'll take his version.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-18 14:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-04 5:17 [PATCH] binder: fix "cast to pointer from integer of different size" warning Jisheng Zhang
2017-09-18 14:02 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).