qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ide: remove undefined behavior in ide-test
@ 2017-02-08 17:05 John Snow
  2017-02-13 15:00 ` Stefan Hajnoczi
  2017-02-15 10:18 ` Michael Tokarev
  0 siblings, 2 replies; 4+ messages in thread
From: John Snow @ 2017-02-08 17:05 UTC (permalink / raw)
  To: qemu-trivial; +Cc: kwolf, qemu-devel, John Snow

trivial: initialize the dirty buffer with a random-ish byte.
Stops valgrind from whining about uninitialized buffers.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 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);
     g_assert(guest_buf);
     g_assert(buf);
 
-- 
2.9.3

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

* Re: [Qemu-devel] [PATCH] ide: remove undefined behavior in ide-test
  2017-02-08 17:05 [Qemu-devel] [PATCH] ide: remove undefined behavior in ide-test John Snow
@ 2017-02-13 15:00 ` Stefan Hajnoczi
  2017-02-13 15:56   ` John Snow
  2017-02-15 10:18 ` Michael Tokarev
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Hajnoczi @ 2017-02-13 15:00 UTC (permalink / raw)
  To: John Snow; +Cc: qemu-trivial, kwolf, qemu-devel

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

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 <jsnow@redhat.com>
> ---
>  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 <stefanha@redhat.com>

>      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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

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

* Re: [Qemu-devel] [PATCH] ide: remove undefined behavior in ide-test
  2017-02-13 15:00 ` Stefan Hajnoczi
@ 2017-02-13 15:56   ` John Snow
  0 siblings, 0 replies; 4+ messages in thread
From: John Snow @ 2017-02-13 15:56 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-trivial, kwolf, qemu-devel



On 02/13/2017 10:00 AM, Stefan Hajnoczi wrote:
> 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 <jsnow@redhat.com>
>> ---
>>  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 <stefanha@redhat.com>
> 

Thanks.

This can go in through the next TRIVIAL pull, as my queue is otherwise
empty right now.

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

Yeah, I did see that ...

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

* Re: [Qemu-devel] [PATCH] ide: remove undefined behavior in ide-test
  2017-02-08 17:05 [Qemu-devel] [PATCH] ide: remove undefined behavior in ide-test John Snow
  2017-02-13 15:00 ` Stefan Hajnoczi
@ 2017-02-15 10:18 ` Michael Tokarev
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2017-02-15 10:18 UTC (permalink / raw)
  To: John Snow, qemu-trivial; +Cc: kwolf, qemu-devel

08.02.2017 20:05, John Snow wrote:
> trivial: initialize the dirty buffer with a random-ish byte.
> Stops valgrind from whining about uninitialized buffers.

Applied to -trivial, thanks!

/mjt

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

end of thread, other threads:[~2017-02-15 10:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-08 17:05 [Qemu-devel] [PATCH] ide: remove undefined behavior in ide-test John Snow
2017-02-13 15:00 ` Stefan Hajnoczi
2017-02-13 15:56   ` John Snow
2017-02-15 10:18 ` Michael Tokarev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).