qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] ide: remove undefined behavior in ide-test


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH] ide: remove undefined behavior in ide-test
Date: Mon, 13 Feb 2017 15:00:03 +0000
User-agent: Mutt/1.7.1 (2016-10-04)

On Wed, Feb 08, 2017 at 12:05:33PM -0500, John Snow wrote:
> trivial: initialize the dirty buffer with a random-ish byte.
> Stops valgrind from whining about uninitialized buffers.
> 
> Signed-off-by: John Snow <address@hidden>
> ---
>  tests/ide-test.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tests/ide-test.c b/tests/ide-test.c
> index 2fa97bc..139ebc0 100644
> --- a/tests/ide-test.c
> +++ b/tests/ide-test.c
> @@ -550,6 +550,7 @@ static void make_dirty(uint8_t device)
>  
>      guest_buf = guest_alloc(guest_malloc, len);
>      buf = g_malloc(len);
> +    memset(buf, rand() % 255 + 1, len);

Reviewed-by: Stefan Hajnoczi <address@hidden>

>      g_assert(guest_buf);
>      g_assert(buf);

Pre-existing issue:
g_assert(buf) is unnecessary since g_malloc() is guaranteed to return
non-NULL.

Attachment: signature.asc
Description: PGP signature


reply via email to

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