On Thu, Jun 06, 2013 at 11:55:36AM +0800, Wenchao Xia wrote: > This patch simply remove "variable may be used uninitialized" warning. > > Signed-off-by: Wenchao Xia <xiaw...@linux.vnet.ibm.com> > --- > libcacard/vscclient.c | 2 +- > util/iov.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libcacard/vscclient.c b/libcacard/vscclient.c > index ac23647..815f453 100644 > --- a/libcacard/vscclient.c > +++ b/libcacard/vscclient.c > @@ -641,7 +641,7 @@ main( > GIOChannel *channel_stdin; > char *qemu_host; > char *qemu_port; > - VSCMsgHeader mhHeader; > + VSCMsgHeader mhHeader = {0}; > > VCardEmulOptions *command_line_options = NULL;
The code looks broken to me: main() { VSCMsgHeader mhHeader; ... send_msg(VSC_Init, mhHeader.reader_id, &init, sizeof(init)); This is really an uninitialized use of mhHeader.read_id. But it gets more interesting: static int send_msg( VSCMsgType type, uint32_t reader_id, const void *msg, unsigned int length ) { VSCMsgHeader mhHeader; qemu_mutex_lock(&socket_to_send_lock); if (verbose > 10) { printf("sending type=%d id=%u, len =%u (0x%x)\n", type, reader_id, length, length); } mhHeader.type = htonl(type); mhHeader.reader_id = 0; mhHeader.length = htonl(length); g_byte_array_append(socket_to_send, (guint8 *)&mhHeader, sizeof(mhHeader)); g_byte_array_append(socket_to_send, (guint8 *)msg, length); g_idle_add(socket_prepare_sending, NULL); qemu_mutex_unlock(&socket_to_send_lock); return 0; } This function prints reader_id if verbose > 0 but it doesn't use it! mhHeader.read_id is always set to 0. This should be cleaned up properly. The other issue you silenced looks okay. Stefan