ide: remove undefined behavior in ide-test
PATCH 1/1 ide: remove undefined behavior in ide-test
trivial: initialize the dirty buffer with a random-ish byte. Stops valgrind from whining about uninitialized buffers.
--- tests/ide-test.c | 1 + 1 file changed, 1 insertion(+)
tests/ide-test.c +1 -0
@@ -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);
Signature · 1 line
2.9.3
Quoted 13 lines · John Snow
trivial: initialize the dirty buffer with a random-ish byte. Stops valgrind from whining about uninitialized buffers.
Signed-off-by John Snow <[email protected]>--- tests/ide-test.c | 1 + 1 file changed, 1 insertion(+)tests/ide-test.c +0
-0
tests/ide-test.c static void make_dirty(uint8_t device) · line 553
Quoted 4 lines
tests/ide-test.c +1
-0@@ -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);
tests/ide-test.c static void make_dirty(uint8_t device) · line 555
Quoted 2 lines
tests/ide-test.c +0
-0g_assert (guest_buf);g_assert (buf);
Pre-existing issue:g_assert(buf) is unnecessary since g_malloc() is guaranteed to return non-NULL.
Quoted 15 lines · Stefan Hajnoczi
Quoted 14 lines · John Snow
trivial: initialize the dirty buffer with a random-ish byte. Stops valgrind from whining about uninitialized buffers.
Signed-off-by John Snow <[email protected]>--- tests/ide-test.c | 1 + 1 file changed, 1 insertion(+)tests/ide-test.c +0
-0@@ -550,6 +550,7 @@ static void make_dirty(uint8_t device)
Quoted 6 lines
tests/ide-test.c static void make_dirty(uint8_t device) · line 553
Quoted 3 lines
tests/ide-test.c +1
-0guest_buf =guest_alloc (guest_malloc, len); buf =g_malloc (len); +memset (buf,rand () %255 +1 , len);Reviewed-by Stefan Hajnoczi <[email protected]>
Thanks.
This can go in through the next TRIVIAL pull, as my queue is otherwise empty right now.
Quoted 7 lines
tests/ide-test.c static void make_dirty(uint8_t device) · line 555
Quoted 2 lines
tests/ide-test.c +0
-0g_assert (guest_buf);g_assert (buf);Pre-existing issue:
g_assert(buf)is unnecessary sinceg_malloc()is guaranteed to return non-NULL.
Yeah, I did see that ...
Michael Tokarev
AppliedQuoted 2 lines · John Snow
trivial: initialize the dirty buffer with a random-ish byte. Stops valgrind from whining about uninitialized buffers.
Applied to -trivial, thanks!
/mjt