[PATCH] binder: fix "cast to pointer from integer of different size" warning
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 --- 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 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3] Revert "staging: Fix build issues with new binder API"
This reverts commit d0bdff0db809 ("staging: Fix build issues with new binder API"), because commit e38361d032f1 ("ARM: 8091/2: add get_user() support for 8 byte types") has added the 64bit __get_user_asm_* implementation. Signed-off-by: Jisheng Zhang --- Since v2: - fix the commit msg again. Since v1: - fix the commit msg drivers/android/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig index 832e885349b1..aca5dc30b97b 100644 --- a/drivers/android/Kconfig +++ b/drivers/android/Kconfig @@ -32,7 +32,7 @@ config ANDROID_BINDER_DEVICES therefore logically separated from the other devices. config ANDROID_BINDER_IPC_32BIT - bool + bool "Use old (Android 4.4 and earlier) 32-bit binder API" depends on !64BIT && ANDROID_BINDER_IPC default y ---help--- -- 2.14.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] binder: allow ANDROID_BINDER_IPC_32BIT to be unselected on 32bit ARM
As noted in commit d0bdff0db809 ("staging: Fix build issues with new binder API"), we can add back the choice for 32bit ARM "once a 64bit __get_user_asm_* implementation is merged." Commit e38361d032f1 ("ARM: 8091/2: add get_user() support for 8 byte types") has added the support, so it's time to allow ANDROID_BINDER_IPC_32BIT to be unselected on 32bit ARM so that the 64bit ABI can be tested/used on 32bit systems. This change allows running the same 32bit userspace build no matter the kernel is 64bit or 32bit. Signed-off-by: Jisheng Zhang --- Since v1: - fix the commit msg drivers/android/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig index 832e885349b1..aca5dc30b97b 100644 --- a/drivers/android/Kconfig +++ b/drivers/android/Kconfig @@ -32,7 +32,7 @@ config ANDROID_BINDER_DEVICES therefore logically separated from the other devices. config ANDROID_BINDER_IPC_32BIT - bool + bool "Use old (Android 4.4 and earlier) 32-bit binder API" depends on !64BIT && ANDROID_BINDER_IPC default y ---help--- -- 2.14.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] binder: let ANDROID_BINDER_IPC_32BIT be selectable on 32bit ARM
On Wed, 23 Aug 2017 13:48:47 -0500 Rob Herring wrote: > On Tue, Aug 22, 2017 at 9:57 PM, John Stultz wrote: > > On Tue, Aug 22, 2017 at 7:56 PM, John Stultz > > wrote: > >> On Tue, Aug 22, 2017 at 7:34 PM, Jisheng Zhang > >> wrote: > >>> On Tue, 22 Aug 2017 18:51:08 -0700 Greg KH wrote: > >>> > >>>> On Tue, Aug 08, 2017 at 07:03:05PM +0800, Jisheng Zhang wrote: > >>>> > As noted in commit d0bdff0db809 ("staging: Fix build issues with new > >>>> > binder API"), we can add back the choice for 32bit ARM "once a 64bit > >>>> > __get_user_asm_* implementation is merged." Commit e38361d032f1 ("ARM: > >>>> > 8091/2: add get_user() support for 8 byte types") has added the > >>>> > support, so it's time to let ANDROID_BINDER_IPC_32BIT be selectable on > >>>> > 32bit ARM > >>>> > >>>> Ok, but: > >>>> > >>>> > > >>>> > Signed-off-by: Jisheng Zhang > >>>> > --- > >>>> > drivers/android/Kconfig | 2 +- > >>>> > 1 file changed, 1 insertion(+), 1 deletion(-) > >>>> > > >>>> > diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig > >>>> > index 832e885349b1..aca5dc30b97b 100644 > >>>> > --- a/drivers/android/Kconfig > >>>> > +++ b/drivers/android/Kconfig > >>>> > @@ -32,7 +32,7 @@ config ANDROID_BINDER_DEVICES > >>>> > therefore logically separated from the other devices. > >>>> > > >>>> > config ANDROID_BINDER_IPC_32BIT > >>>> > - bool > >>>> > + bool "Use old (Android 4.4 and earlier) 32-bit binder API" > >>>> > depends on !64BIT && ANDROID_BINDER_IPC > >>>> > >>>> You don't actually change the depends line :( > >>>> > >>>> Please fix up, and test it, and then resend. > >>> > >>> IHOM, the dependency is correct: 64bit platforms don't support > >>> ANDROID_BINDER_IPC_32BIT. What do you think? > >> > >> I think this indicates the commit message is unclear. > >> > >> Part of it is that the config is inverted from the description. The > >> patch doesn't enable the 32bit legacy binder ABI on 32bit systems, it > >> just allows the option to be unselected, so that the 64bit ABI will be > >> used on 32bit systems. > >> > >> Conceptually I don't have an objection to the change (though maybe try > >> to rework the commit message), but I don't have anything to actually > >> test it on right now, so I'm hesitant to ack it. > > > > It might also be good to add some detail as to the motivation for this > > change? What benefit does it bring to 32bit platforms to use the newer > > 64bit ABI? > > It allows running the same 32-bit userspace build whether the kernel > is 64-bit or 32-bit. > Oh, yes, this is a good "motivation" which can be added into the commit msg. thanks for the inspiration. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] binder: let ANDROID_BINDER_IPC_32BIT be selectable on 32bit ARM
On Tue, 22 Aug 2017 19:57:04 -0700 John Stultz wrote: > On Tue, Aug 22, 2017 at 7:56 PM, John Stultz wrote: > > On Tue, Aug 22, 2017 at 7:34 PM, Jisheng Zhang wrote: > > > >> On Tue, 22 Aug 2017 18:51:08 -0700 Greg KH wrote: > >> > >>> On Tue, Aug 08, 2017 at 07:03:05PM +0800, Jisheng Zhang wrote: > >>> > As noted in commit d0bdff0db809 ("staging: Fix build issues with new > >>> > binder API"), we can add back the choice for 32bit ARM "once a 64bit > >>> > __get_user_asm_* implementation is merged." Commit e38361d032f1 ("ARM: > >>> > 8091/2: add get_user() support for 8 byte types") has added the > >>> > support, so it's time to let ANDROID_BINDER_IPC_32BIT be selectable on > >>> > 32bit ARM > >>> > >>> Ok, but: > >>> > >>> > > >>> > Signed-off-by: Jisheng Zhang > >>> > --- > >>> > drivers/android/Kconfig | 2 +- > >>> > 1 file changed, 1 insertion(+), 1 deletion(-) > >>> > > >>> > diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig > >>> > index 832e885349b1..aca5dc30b97b 100644 > >>> > --- a/drivers/android/Kconfig > >>> > +++ b/drivers/android/Kconfig > >>> > @@ -32,7 +32,7 @@ config ANDROID_BINDER_DEVICES > >>> > therefore logically separated from the other devices. > >>> > > >>> > config ANDROID_BINDER_IPC_32BIT > >>> > - bool > >>> > + bool "Use old (Android 4.4 and earlier) 32-bit binder API" > >>> > depends on !64BIT && ANDROID_BINDER_IPC > >>> > >>> You don't actually change the depends line :( > >>> > >>> Please fix up, and test it, and then resend. > >> > >> IHOM, the dependency is correct: 64bit platforms don't support > >> ANDROID_BINDER_IPC_32BIT. What do you think? > > > > I think this indicates the commit message is unclear. > > > > Part of it is that the config is inverted from the description. The > > patch doesn't enable the 32bit legacy binder ABI on 32bit systems, it > > just allows the option to be unselected, so that the 64bit ABI will be > > used on 32bit systems. > > > > Conceptually I don't have an objection to the change (though maybe try > > to rework the commit message), but I don't have anything to actually > > test it on right now, so I'm hesitant to ack it. > > It might also be good to add some detail as to the motivation for this > change? What benefit does it bring to 32bit platforms to use the newer > 64bit ABI? > To be honest, the motivation is just to add one more choice for 32bit platform and let the code be tested under 32bit platform. Maybe we could then remove ANDROID_BINDER_IPC_32BIT and the related code after some time? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [EXT] Re: [PATCH] binder: let ANDROID_BINDER_IPC_32BIT be selectable on 32bit ARM
On Tue, 22 Aug 2017 19:56:07 -0700 John Stultz wrote: > External Email > > -- > On Tue, Aug 22, 2017 at 7:34 PM, Jisheng Zhang wrote: > > On Tue, 22 Aug 2017 18:51:08 -0700 Greg KH wrote: > > > >> On Tue, Aug 08, 2017 at 07:03:05PM +0800, Jisheng Zhang wrote: > >> > As noted in commit d0bdff0db809 ("staging: Fix build issues with new > >> > binder API"), we can add back the choice for 32bit ARM "once a 64bit > >> > __get_user_asm_* implementation is merged." Commit e38361d032f1 ("ARM: > >> > 8091/2: add get_user() support for 8 byte types") has added the > >> > support, so it's time to let ANDROID_BINDER_IPC_32BIT be selectable on > >> > 32bit ARM > >> > >> Ok, but: > >> > >> > > >> > Signed-off-by: Jisheng Zhang > >> > --- > >> > drivers/android/Kconfig | 2 +- > >> > 1 file changed, 1 insertion(+), 1 deletion(-) > >> > > >> > diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig > >> > index 832e885349b1..aca5dc30b97b 100644 > >> > --- a/drivers/android/Kconfig > >> > +++ b/drivers/android/Kconfig > >> > @@ -32,7 +32,7 @@ config ANDROID_BINDER_DEVICES > >> > therefore logically separated from the other devices. > >> > > >> > config ANDROID_BINDER_IPC_32BIT > >> > - bool > >> > + bool "Use old (Android 4.4 and earlier) 32-bit binder API" > >> > depends on !64BIT && ANDROID_BINDER_IPC > >> > >> You don't actually change the depends line :( > >> > >> Please fix up, and test it, and then resend. > > > > IHOM, the dependency is correct: 64bit platforms don't support > > ANDROID_BINDER_IPC_32BIT. What do you think? > > I think this indicates the commit message is unclear. > > Part of it is that the config is inverted from the description. The > patch doesn't enable the 32bit legacy binder ABI on 32bit systems, it > just allows the option to be unselected, so that the 64bit ABI will be > used on 32bit systems. > > Conceptually I don't have an objection to the change (though maybe try > to rework the commit message), but I don't have anything to actually > test it on right now, so I'm hesitant to ack it. > I have tested it on Marvell Berlin 32bit platform: the 64bit binder IPC works fine on our 32bit platform. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] binder: let ANDROID_BINDER_IPC_32BIT be selectable on 32bit ARM
On Tue, 22 Aug 2017 18:51:08 -0700 Greg KH wrote: > On Tue, Aug 08, 2017 at 07:03:05PM +0800, Jisheng Zhang wrote: > > As noted in commit d0bdff0db809 ("staging: Fix build issues with new > > binder API"), we can add back the choice for 32bit ARM "once a 64bit > > __get_user_asm_* implementation is merged." Commit e38361d032f1 ("ARM: > > 8091/2: add get_user() support for 8 byte types") has added the > > support, so it's time to let ANDROID_BINDER_IPC_32BIT be selectable on > > 32bit ARM > > Ok, but: > > > > > Signed-off-by: Jisheng Zhang > > --- > > drivers/android/Kconfig | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig > > index 832e885349b1..aca5dc30b97b 100644 > > --- a/drivers/android/Kconfig > > +++ b/drivers/android/Kconfig > > @@ -32,7 +32,7 @@ config ANDROID_BINDER_DEVICES > > therefore logically separated from the other devices. > > > > config ANDROID_BINDER_IPC_32BIT > > - bool > > + bool "Use old (Android 4.4 and earlier) 32-bit binder API" > > depends on !64BIT && ANDROID_BINDER_IPC > > You don't actually change the depends line :( > > Please fix up, and test it, and then resend. IHOM, the dependency is correct: 64bit platforms don't support ANDROID_BINDER_IPC_32BIT. What do you think? Thanks, Jisheng ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] binder: let ANDROID_BINDER_IPC_32BIT be selectable on 32bit ARM
As noted in commit d0bdff0db809 ("staging: Fix build issues with new binder API"), we can add back the choice for 32bit ARM "once a 64bit __get_user_asm_* implementation is merged." Commit e38361d032f1 ("ARM: 8091/2: add get_user() support for 8 byte types") has added the support, so it's time to let ANDROID_BINDER_IPC_32BIT be selectable on 32bit ARM Signed-off-by: Jisheng Zhang --- drivers/android/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig index 832e885349b1..aca5dc30b97b 100644 --- a/drivers/android/Kconfig +++ b/drivers/android/Kconfig @@ -32,7 +32,7 @@ config ANDROID_BINDER_DEVICES therefore logically separated from the other devices. config ANDROID_BINDER_IPC_32BIT - bool + bool "Use old (Android 4.4 and earlier) 32-bit binder API" depends on !64BIT && ANDROID_BINDER_IPC default y ---help--- -- 2.14.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel