* [PATCH] binder: fix printk format for commands
@ 2022-05-09 23:19 Carlos Llamas
2022-05-09 23:24 ` Todd Kjos
2022-05-10 10:12 ` Christian Brauner
0 siblings, 2 replies; 3+ messages in thread
From: Carlos Llamas @ 2022-05-09 23:19 UTC (permalink / raw)
To: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
Martijn Coenen, Christian Brauner
Cc: Joel Fernandes, Hridya Valsaraju, Suren Baghdasaryan,
kernel-team, linux-kernel, Carlos Llamas
Make sure we use unsigned format specifier %u for binder commands as
most of them are encoded above INT_MAX. This prevents negative values
when logging them as in the following case:
[ 211.895781] binder: 8668:8668 BR_REPLY 258949 0:0, cmd -2143260157 size 0-0 ptr 0000006e766a8000-0000006e766a8000
Signed-off-by: Carlos Llamas <cmllamas@google.com>
---
drivers/android/binder.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index f3b639e89dd8..b4b0e4489bef 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -3984,7 +3984,7 @@ static int binder_thread_write(struct binder_proc *proc,
} break;
default:
- pr_err("%d:%d unknown command %d\n",
+ pr_err("%d:%d unknown command %u\n",
proc->pid, thread->pid, cmd);
return -EINVAL;
}
@@ -4490,7 +4490,7 @@ static int binder_thread_read(struct binder_proc *proc,
trace_binder_transaction_received(t);
binder_stat_br(proc, thread, cmd);
binder_debug(BINDER_DEBUG_TRANSACTION,
- "%d:%d %s %d %d:%d, cmd %d size %zd-%zd ptr %016llx-%016llx\n",
+ "%d:%d %s %d %d:%d, cmd %u size %zd-%zd ptr %016llx-%016llx\n",
proc->pid, thread->pid,
(cmd == BR_TRANSACTION) ? "BR_TRANSACTION" :
(cmd == BR_TRANSACTION_SEC_CTX) ?
--
2.36.0.512.ge40c2bad7a-goog
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] binder: fix printk format for commands
2022-05-09 23:19 [PATCH] binder: fix printk format for commands Carlos Llamas
@ 2022-05-09 23:24 ` Todd Kjos
2022-05-10 10:12 ` Christian Brauner
1 sibling, 0 replies; 3+ messages in thread
From: Todd Kjos @ 2022-05-09 23:24 UTC (permalink / raw)
To: Carlos Llamas
Cc: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
Martijn Coenen, Christian Brauner, Joel Fernandes,
Hridya Valsaraju, Suren Baghdasaryan, kernel-team, linux-kernel
On Mon, May 9, 2022 at 4:19 PM Carlos Llamas <cmllamas@google.com> wrote:
>
> Make sure we use unsigned format specifier %u for binder commands as
> most of them are encoded above INT_MAX. This prevents negative values
> when logging them as in the following case:
>
> [ 211.895781] binder: 8668:8668 BR_REPLY 258949 0:0, cmd -2143260157 size 0-0 ptr 0000006e766a8000-0000006e766a8000
>
> Signed-off-by: Carlos Llamas <cmllamas@google.com>
Acked-by: Todd Kjos <tkjos@google.com>
> ---
> drivers/android/binder.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/android/binder.c b/drivers/android/binder.c
> index f3b639e89dd8..b4b0e4489bef 100644
> --- a/drivers/android/binder.c
> +++ b/drivers/android/binder.c
> @@ -3984,7 +3984,7 @@ static int binder_thread_write(struct binder_proc *proc,
> } break;
>
> default:
> - pr_err("%d:%d unknown command %d\n",
> + pr_err("%d:%d unknown command %u\n",
> proc->pid, thread->pid, cmd);
> return -EINVAL;
> }
> @@ -4490,7 +4490,7 @@ static int binder_thread_read(struct binder_proc *proc,
> trace_binder_transaction_received(t);
> binder_stat_br(proc, thread, cmd);
> binder_debug(BINDER_DEBUG_TRANSACTION,
> - "%d:%d %s %d %d:%d, cmd %d size %zd-%zd ptr %016llx-%016llx\n",
> + "%d:%d %s %d %d:%d, cmd %u size %zd-%zd ptr %016llx-%016llx\n",
> proc->pid, thread->pid,
> (cmd == BR_TRANSACTION) ? "BR_TRANSACTION" :
> (cmd == BR_TRANSACTION_SEC_CTX) ?
> --
> 2.36.0.512.ge40c2bad7a-goog
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] binder: fix printk format for commands
2022-05-09 23:19 [PATCH] binder: fix printk format for commands Carlos Llamas
2022-05-09 23:24 ` Todd Kjos
@ 2022-05-10 10:12 ` Christian Brauner
1 sibling, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2022-05-10 10:12 UTC (permalink / raw)
To: Carlos Llamas
Cc: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
Martijn Coenen, Joel Fernandes, Hridya Valsaraju,
Suren Baghdasaryan, kernel-team, linux-kernel
On Mon, May 09, 2022 at 11:19:01PM +0000, Carlos Llamas wrote:
> Make sure we use unsigned format specifier %u for binder commands as
> most of them are encoded above INT_MAX. This prevents negative values
> when logging them as in the following case:
>
> [ 211.895781] binder: 8668:8668 BR_REPLY 258949 0:0, cmd -2143260157 size 0-0 ptr 0000006e766a8000-0000006e766a8000
>
> Signed-off-by: Carlos Llamas <cmllamas@google.com>
> ---
Looks good to me,
Acked-by: Christian Brauner (Microsoft) <brauner@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-05-10 10:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09 23:19 [PATCH] binder: fix printk format for commands Carlos Llamas
2022-05-09 23:24 ` Todd Kjos
2022-05-10 10:12 ` Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®