Re: [PATCH 05/13] android: binder: refactor binder_transact transaction buffer loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux