misc/161175: uninitialized variables on some regression test programs

Giovanni Trematerra gianni at FreeBSD.org
Fri Sep 30 22:20:02 UTC 2011


>Number:         161175
>Category:       misc
>Synopsis:       uninitialized variables on some regression test programs
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 30 22:20:02 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Giovanni Trematerra
>Release:        10-CURRENT
>Organization:
>Environment:
>Description:
Some regression tests in tools/regression/pipe has some uninitialized variables that make the test fails.
>How-To-Repeat:
cd /usr/src/tools/regression/pipe
cc -O2 -o pipe-wraparound pipe-wraparound.c
cc -O2 -o pipe-reverse pipe-reverse.c
cc -O2 -o pipe-fstatbug pipe-fstatbug.c

./pipe-wraparound
./pipe-reverse
./pipe-fstatbug
>Fix:
Index: tools/regression/pipe/pipe-reverse.c
===================================================================
--- tools/regression/pipe/pipe-reverse.c	(revision 225817)
+++ tools/regression/pipe/pipe-reverse.c	(working copy)
@@ -44,6 +44,7 @@ struct stat status;
 pid_t new_pid;
 
 buggy = 0;
+total = 0;
 
 error = pipe(desc);
 
@@ -52,7 +53,7 @@ if (error)
 
 buffer[0] = 'A';
 
-for (i = 0; i < 65535; i++) {
+for (i = 1; i < 65535; i++) {
 	buffer[i] = buffer[i - 1] + 1;
 	if (buffer[i] > 'Z')
 		buffer[i] = 'A';
Index: tools/regression/pipe/pipe-fstatbug.c
===================================================================
--- tools/regression/pipe/pipe-fstatbug.c	(revision 225817)
+++ tools/regression/pipe/pipe-fstatbug.c	(working copy)
@@ -41,7 +41,7 @@ int main (void)
 {
 char buffer[32768], buffer2[32768];
 int desc[2];
-int error, successes;
+int error, successes = 0;
 struct stat status;
 pid_t new_pid;
 
Index: tools/regression/pipe/pipe-wraparound.c
===================================================================
--- tools/regression/pipe/pipe-wraparound.c	(revision 225817)
+++ tools/regression/pipe/pipe-wraparound.c	(working copy)
@@ -44,6 +44,7 @@ struct stat status;
 pid_t new_pid;
 
 buggy = 0;
+total = 0;
 
 error = pipe(desc);
 
@@ -52,7 +53,7 @@ if (error)
 
 buffer[0] = 'A';
 
-for (i = 0; i < 32768; i++) {
+for (i = 1; i < 32768; i++) {
 	buffer[i] = buffer[i - 1] + 1;
 	if (buffer[i] > 'Z')
 		buffer[i] = 'A';


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list