[lkml]   [2015]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 05/13] android: binder: refactor binder_transact transaction buffer loop
On Thu, May 28, 2015 at 04:08:23PM -0700, Riley Andrews wrote:
> +static int binder_transaction_buffer_acquire(
> + struct binder_transaction *t, struct binder_transaction_data *tr,
> + struct binder_thread *thread, struct binder_transaction *in_reply_to)
> +{
> + struct binder_proc *proc = thread->proc;
> + binder_size_t *offp, *off_end, off_min;
> + struct flat_binder_object *fp;
> + uint32_t result;
> +
> + if (!IS_ALIGNED(tr->offsets_size, sizeof(binder_size_t))) {
> + binder_user_error("%d:%d got transaction with invalid offsets size, %lld\n",
> + proc->pid, thread->pid,
> + (u64)tr->offsets_size);
> + return BR_FAILED_REPLY;

This smells like a behavior change. In the original code we called
trace_binder_transaction_failed_buffer_release(). Are you sure it's

Naming the labels after the goto location is an anti-pattern.

aaa = kmalloc();
if (!aaa)
goto kmalloc_failed;

The label name doesn't provide useful information compared to the line
before. If binder_transaction_buffer_acquire() fails we say "goto
err_translate_failed;" but actually translate didn't fail because we
haven't yet attempted to translate so the little information the label
does provide is misleading. Grumble grumble etc. Also "error:" is a
meaningless label name. Name labels after what the label does
"goto release_buffer;".

dan carpenter

 \ /
  Last update: 2015-05-29 13:01    [W:0.087 / U:1.328 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site