qemu-trivial
[Top][All Lists]
Advanced

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

Re: [Qemu-trivial] [Qemu-devel] [PATCH 5/5] libcacard/vscclient.c: fix u


From: Peter Maydell
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH 5/5] libcacard/vscclient.c: fix use of uninitialized variable
Date: Tue, 4 Jun 2013 22:12:16 +0100

On 4 June 2013 21:23, Alon Levy <address@hidden> wrote:
> Found by Coverity.
>
> Signed-off-by: Alon Levy <address@hidden>
> ---
>  libcacard/vscclient.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libcacard/vscclient.c b/libcacard/vscclient.c
> index 5180d29..4275c23 100644
> --- a/libcacard/vscclient.c
> +++ b/libcacard/vscclient.c
> @@ -645,7 +645,7 @@ main(
>      GIOChannel *channel_stdin;
>      char *qemu_host;
>      char *qemu_port;
> -    VSCMsgHeader mhHeader;
> +    VSCMsgHeader mhHeader = {0,};

As far as I can see we only use this variable once:

    send_msg(VSC_Init, mhHeader.reader_id, &init, sizeof(init));

so wouldn't it be better just to directly pass a constant
"0" to the send_msg() call? Hiding a single uint32_t in
a struct seems a bit obscure.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]