[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/3] tests: Fix uninitialized byte in test_visitor_i
From: |
Andrey Shinkevich |
Subject: |
[Qemu-devel] [PATCH 2/3] tests: Fix uninitialized byte in test_visitor_in_fuzz |
Date: |
Tue, 30 Jul 2019 19:01:37 +0300 |
One byte in the local buffer stays uninitialized, at least with the
first iteration, because of the double decrement in the
test_visitor_in_fuzz(). This is what Valgrind does not like and not
critical for the test itself. So, reduce the number of the memory
issues reports.
Signed-off-by: Andrey Shinkevich <address@hidden>
---
tests/test-string-input-visitor.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/tests/test-string-input-visitor.c
b/tests/test-string-input-visitor.c
index 34b54df..5418e08 100644
--- a/tests/test-string-input-visitor.c
+++ b/tests/test-string-input-visitor.c
@@ -444,16 +444,14 @@ static void test_visitor_in_fuzz(TestInputVisitorData
*data,
char buf[10000];
for (i = 0; i < 100; i++) {
- unsigned int j;
+ unsigned int j, k;
j = g_test_rand_int_range(0, sizeof(buf) - 1);
buf[j] = '\0';
- if (j != 0) {
- for (j--; j != 0; j--) {
- buf[j - 1] = (char)g_test_rand_int_range(0, 256);
- }
+ for (k = 0; k != j; k++) {
+ buf[k] = (char)g_test_rand_int_range(0, 256);
}
v = visitor_input_test_init(data, buf);
--
1.8.3.1
- Re: [Qemu-devel] [PATCH 3/3] i386/kvm: initialize struct at full before ioctl call, (continued)
- Re: [Qemu-devel] [PATCH 3/3] i386/kvm: initialize struct at full before ioctl call, Peter Maydell, 2019/07/30
- Re: [Qemu-devel] [PATCH 3/3] i386/kvm: initialize struct at full before ioctl call, Paolo Bonzini, 2019/07/30
- Re: [Qemu-devel] [PATCH 3/3] i386/kvm: initialize struct at full before ioctl call, Christian Borntraeger, 2019/07/31
- Re: [Qemu-devel] [PATCH 3/3] i386/kvm: initialize struct at full before ioctl call, Andrey Shinkevich, 2019/07/31
- Re: [Qemu-devel] [PATCH 3/3] i386/kvm: initialize struct at full before ioctl call, Christian Borntraeger, 2019/07/31
- Re: [Qemu-devel] [PATCH 3/3] i386/kvm: initialize struct at full before ioctl call, Christian Borntraeger, 2019/07/31
- Re: [Qemu-devel] [PATCH 3/3] i386/kvm: initialize struct at full before ioctl call, Paolo Bonzini, 2019/07/31
- Re: [Qemu-devel] [PATCH 3/3] i386/kvm: initialize struct at full before ioctl call, Andrey Shinkevich, 2019/07/31
[Qemu-devel] [PATCH 2/3] tests: Fix uninitialized byte in test_visitor_in_fuzz,
Andrey Shinkevich <=