[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231204115704.40543-1-aliceryhl@google.com>
Date: Mon, 4 Dec 2023 11:57:04 +0000
From: Alice Ryhl <aliceryhl@...gle.com>
To: cmllamas@...gle.com
Cc: arve@...roid.com, brauner@...nel.org, gregkh@...uxfoundation.org,
joel@...lfernandes.org, kernel-team@...roid.com,
linux-kernel@...r.kernel.org, maco@...roid.com, surenb@...gle.com,
tkjos@...roid.com, Alice Ryhl <aliceryhl@...gle.com>
Subject: Re: [PATCH v2 11/28] binder: do unlocked work in binder_alloc_new_buf()
> Extract non-critical sections from binder_alloc_new_buf_locked() that
> don't require holding the alloc->mutex. While we are here, consolidate
> the checks for size overflow and zero-sized padding into a separate
> sanitized_size() helper function.
>
> Also add a few touchups to follow the coding guidelines.
>
> Signed-off-by: Carlos Llamas <cmllamas@...gle.com>
Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>
> + if (IS_ERR(buffer)) {
> + mutex_unlock(&alloc->mutex);
> + goto out;
> + }
> +
> + buffer->data_size = data_size;
> + buffer->offsets_size = offsets_size;
> + buffer->extra_buffers_size = extra_buffers_size;
> mutex_unlock(&alloc->mutex);
> +
> +out:
> return buffer;
> }
You could also write this as:
if (!IS_ERR(buffer)) {
buffer->data_size = data_size;
buffer->offsets_size = offsets_size;
buffer->extra_buffers_size = extra_buffers_size;
}
mutex_unlock(&alloc->mutex);
return buffer;
But I'm happy either way.
Alice
Powered by blists - more mailing lists