Commit da486496 authored by Carlos Llamas's avatar Carlos Llamas Committed by Greg Kroah-Hartman

binder: fix printk format for commands

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
Acked-by: default avatarTodd Kjos <tkjos@google.com>
Acked-by: default avatarChristian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: default avatarCarlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20220509231901.3852573-1-cmllamas@google.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent dc6a7eff
...@@ -4083,7 +4083,7 @@ static int binder_thread_write(struct binder_proc *proc, ...@@ -4083,7 +4083,7 @@ static int binder_thread_write(struct binder_proc *proc,
} break; } break;
default: default:
pr_err("%d:%d unknown command %d\n", pr_err("%d:%d unknown command %u\n",
proc->pid, thread->pid, cmd); proc->pid, thread->pid, cmd);
return -EINVAL; return -EINVAL;
} }
...@@ -4578,7 +4578,7 @@ static int binder_thread_read(struct binder_proc *proc, ...@@ -4578,7 +4578,7 @@ static int binder_thread_read(struct binder_proc *proc,
trace_binder_transaction_received(t); trace_binder_transaction_received(t);
binder_stat_br(proc, thread, cmd); binder_stat_br(proc, thread, cmd);
binder_debug(BINDER_DEBUG_TRANSACTION, 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, proc->pid, thread->pid,
(cmd == BR_TRANSACTION) ? "BR_TRANSACTION" : (cmd == BR_TRANSACTION) ? "BR_TRANSACTION" :
(cmd == BR_TRANSACTION_SEC_CTX) ? (cmd == BR_TRANSACTION_SEC_CTX) ?
......
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