Re: [PATCH 05/13] android: binder: refactor binder_transact transaction buffer loop
From: Dan Carpenter
Date: Fri May 29 2015 - 06:26:24 EST
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
correct?
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;".
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/