All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Initialise buffer and buffer_size before used
@ 2012-02-27  8:39 Zhengwang Ruan
  2012-02-27  9:55 ` Dan Carpenter
  2012-02-27 10:22 ` Zhengwang Ruan
  0 siblings, 2 replies; 3+ messages in thread
From: Zhengwang Ruan @ 2012-02-27  8:39 UTC (permalink / raw)
  To: kernel-janitors

GCC warns 'buffer' and 'buffer_size' are used with being uninitialized, and
'buffer' is used as returned value, and 'buffer_size' is initialized using
uninitialized_var to clear warning.

Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
---
 drivers/staging/android/binder.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index 4350425..6caebeb 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -716,8 +716,8 @@ static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc,
 					      size_t offsets_size, int is_async)
 {
 	struct rb_node *n = proc->free_buffers.rb_node;
-	struct binder_buffer *buffer;
-	size_t buffer_size;
+	struct binder_buffer *buffer = NULL;
+	size_t uninitialized_var(buffer_size);
 	struct rb_node *best_fit = NULL;
 	void *has_page_addr;
 	void *end_page_addr;
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Initialise buffer and buffer_size before used
  2012-02-27  8:39 [PATCH] Initialise buffer and buffer_size before used Zhengwang Ruan
@ 2012-02-27  9:55 ` Dan Carpenter
  2012-02-27 10:22 ` Zhengwang Ruan
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2012-02-27  9:55 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1343 bytes --]

On Mon, Feb 27, 2012 at 04:39:45PM +0800, Zhengwang Ruan wrote:
> GCC warns 'buffer' and 'buffer_size' are used with being uninitialized, and
> 'buffer' is used as returned value, and 'buffer_size' is initialized using
> uninitialized_var to clear warning.
> 

If you wanted to use the uninitialized_var() macro for a pointer,
the trick is:

	struct binder_buffer *uninitialized_var(buffer);

But this is fine as is.

The subject should have a subsystem prefix.  You'll need to resend
both patches for that reason.  (You had them correct in the original
version you sent to kj).  The subjects could also say [patch 1/2]
and [patch 2/2] but it doesn't matter since the line numbers didn't
change and they can be applied in any order.

Don't forget to CC Greg.  He reads the list as well, but you should
always CC a maintainer and a list for each patch.

Anyway, it looks good.  Just fix the subjects and resend.  When you
resend a patch it should say [patch 1/2 v2] in the subject and below
the signed off by line put:
---
v2: added a subsystem prefix to the subject

Sorry that it's a lot of nit picky work.  We have to push as much
work as we can on to patch submitters so that maintainers can apply
things with a click of the mouse.  After a while you'll learn all
the rules.  :)

regards,
dan carpenter


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Initialise buffer and buffer_size before used
  2012-02-27  8:39 [PATCH] Initialise buffer and buffer_size before used Zhengwang Ruan
  2012-02-27  9:55 ` Dan Carpenter
@ 2012-02-27 10:22 ` Zhengwang Ruan
  1 sibling, 0 replies; 3+ messages in thread
From: Zhengwang Ruan @ 2012-02-27 10:22 UTC (permalink / raw)
  To: kernel-janitors




-------- Original Message --------
From: Dan Carpenter
Sent: 2012年02月27日 星期一 12时55分58秒
To: Zhengwang Ruan
Subject: Re: [PATCH] Initialise buffer and buffer_size before used
> On Mon, Feb 27, 2012 at 04:39:45PM +0800, Zhengwang Ruan wrote:
>> GCC warns 'buffer' and 'buffer_size' are used with being uninitialized, and
>> 'buffer' is used as returned value, and 'buffer_size' is initialized using
>> uninitialized_var to clear warning.
>>
> If you wanted to use the uninitialized_var() macro for a pointer,
> the trick is:
>
> 	struct binder_buffer *uninitialized_var(buffer);
>
> But this is fine as is.
>
> The subject should have a subsystem prefix.  You'll need to resend
> both patches for that reason.  (You had them correct in the original
> version you sent to kj).  The subjects could also say [patch 1/2]
> and [patch 2/2] but it doesn't matter since the line numbers didn't
> change and they can be applied in any order.
>
> Don't forget to CC Greg.  He reads the list as well, but you should
> always CC a maintainer and a list for each patch.
>
> Anyway, it looks good.  Just fix the subjects and resend.  When you
> resend a patch it should say [patch 1/2 v2] in the subject and below
> the signed off by line put:
> ---
> v2: added a subsystem prefix to the subject
>
> Sorry that it's a lot of nit picky work.  We have to push as much
> work as we can on to patch submitters so that maintainers can apply
> things with a click of the mouse.  After a while you'll learn all
> the rules.  :)
>

Thank you and resend it again! :-)

Brs,
-Zhengwang
> regards,
> dan carpenter
>

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-02-27 10:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-27  8:39 [PATCH] Initialise buffer and buffer_size before used Zhengwang Ruan
2012-02-27  9:55 ` Dan Carpenter
2012-02-27 10:22 ` Zhengwang Ruan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.