Messages in this thread |  | | | Date | Wed, 07 Mar 2012 12:58:16 +0800 | | From | Zhengwang Ruan <> | | Subject | Re: [PATCH 2/2 v2] Staging:android: Initialise buffer and buffer_size before used |
| |
-------- Original Message -------- From: Arve Hjønnevåg Sent: 2012年03月06日 星期二 20时01分58秒 To: Zhengwang Ruan Subject: Re: [PATCH 2/2 v2] Staging:android: Initialise buffer and buffer_size before used > On Tue, Mar 6, 2012 at 6:36 PM, Zhengwang Ruan<ruan.zhengwang@gmail.com> 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. > Why do you clear the warning on buffer_size with uninitialized_var() > but not on buffer? struct binder_buffer *buffer; size_t buffer_size; struct rb_node *best_fit = NULL;
I see 'best_fit' is initialized by being directly assigned a NULL pointer, I think it should be better to initialize pointer in this way.
> Neither variable is used before being initialized. > I got the following compiling warning against buffer ans buffer_size:
drivers/staging/android/binder.c:719:24: warning: ‘buffer’ may be used uninitialized in this function drivers/staging/android/binder.c:720:9: warning: ‘buffer_size’ may be used uninitialized in this function
Thanks, -Zhengwang
-- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |