svn rev #25147: trunk/src/plugins/kdb/db2/libdb2/ btree/ hash/ recno/

raeburn@MIT.EDU raeburn at MIT.EDU
Sun Sep 4 21:22:03 EDT 2011


http://src.mit.edu/fisheye/changelog/krb5/?cs=25147
Commit By: raeburn
Log Message:
Fix "may be used uninitialized" warnings in db2 code, even though all
such cases appear to be safe.  This will permit making
uninitialized-variable messages fatal.


Changed Files:
U   trunk/src/plugins/kdb/db2/libdb2/btree/bt_delete.c
U   trunk/src/plugins/kdb/db2/libdb2/btree/bt_search.c
U   trunk/src/plugins/kdb/db2/libdb2/btree/bt_seq.c
U   trunk/src/plugins/kdb/db2/libdb2/btree/bt_split.c
U   trunk/src/plugins/kdb/db2/libdb2/hash/hash_page.c
U   trunk/src/plugins/kdb/db2/libdb2/recno/rec_open.c
Modified: trunk/src/plugins/kdb/db2/libdb2/btree/bt_delete.c
===================================================================
--- trunk/src/plugins/kdb/db2/libdb2/btree/bt_delete.c	2011-09-05 01:21:55 UTC (rev 25146)
+++ trunk/src/plugins/kdb/db2/libdb2/btree/bt_delete.c	2011-09-05 01:22:03 UTC (rev 25147)
@@ -150,7 +150,7 @@
 	EPG *e;
 	EPGNO *parent;
 	PAGE *h;
-	indx_t idx;
+	indx_t idx = 0;
 	db_pgno_t pgno;
 	recno_t nextpg, prevpg;
 	int exact, level;

Modified: trunk/src/plugins/kdb/db2/libdb2/btree/bt_search.c
===================================================================
--- trunk/src/plugins/kdb/db2/libdb2/btree/bt_search.c	2011-09-05 01:21:55 UTC (rev 25146)
+++ trunk/src/plugins/kdb/db2/libdb2/btree/bt_search.c	2011-09-05 01:22:03 UTC (rev 25147)
@@ -157,7 +157,7 @@
 	BINTERNAL *bi;
 	EPG e;
 	EPGNO *parent;
-	indx_t idx;
+	indx_t idx = 0;
 	db_pgno_t pgno;
 	int level;
 
@@ -237,7 +237,7 @@
 	BINTERNAL *bi;
 	EPG e;
 	EPGNO *parent;
-	indx_t idx;
+	indx_t idx = 0;
 	db_pgno_t pgno;
 	int level;
 

Modified: trunk/src/plugins/kdb/db2/libdb2/btree/bt_seq.c
===================================================================
--- trunk/src/plugins/kdb/db2/libdb2/btree/bt_seq.c	2011-09-05 01:21:55 UTC (rev 25146)
+++ trunk/src/plugins/kdb/db2/libdb2/btree/bt_seq.c	2011-09-05 01:22:03 UTC (rev 25147)
@@ -269,7 +269,7 @@
 {
 	CURSOR *c;
 	PAGE *h;
-	indx_t idx;
+	indx_t idx = 0;
 	db_pgno_t pg;
 	int exact, rval;
 
@@ -818,7 +818,7 @@
 {
 	CURSOR *c;
 	PAGE *h;
-	indx_t idx;
+	indx_t idx = 0;
 	db_pgno_t pg;
 	int status;
 	EPGNO *e;

Modified: trunk/src/plugins/kdb/db2/libdb2/btree/bt_split.c
===================================================================
--- trunk/src/plugins/kdb/db2/libdb2/btree/bt_split.c	2011-09-05 01:21:55 UTC (rev 25146)
+++ trunk/src/plugins/kdb/db2/libdb2/btree/bt_split.c	2011-09-05 01:22:03 UTC (rev 25147)
@@ -87,14 +87,14 @@
 	size_t ilen;
 	u_int32_t argskip;
 {
-	BINTERNAL *bi;
-	BLEAF *bl, *tbl;
+	BINTERNAL *bi = NULL;
+	BLEAF *bl = NULL, *tbl;
 	DBT a, b;
 	EPGNO *parent;
 	PAGE *h, *l, *r, *lchild, *rchild;
 	indx_t nxtindex;
 	u_int16_t skip;
-	u_int32_t n, nbytes, nksize;
+	u_int32_t n, nbytes, nksize = 0;
 	int parentsplit;
 	char *dest;
 
@@ -637,6 +637,7 @@
 	full = t->bt_psize - BTDATAOFF;
 	half = full / 2;
 	used = 0;
+	src = NULL;	     /* silence gcc "uninitialized" warning */
 	for (nxt = off = 0, top = NEXTINDEX(h); nxt < top; ++off) {
 		if (skip == off) {
 			nbytes = ilen;

Modified: trunk/src/plugins/kdb/db2/libdb2/hash/hash_page.c
===================================================================
--- trunk/src/plugins/kdb/db2/libdb2/hash/hash_page.c	2011-09-05 01:21:55 UTC (rev 25146)
+++ trunk/src/plugins/kdb/db2/libdb2/hash/hash_page.c	2011-09-05 01:22:03 UTC (rev 25147)
@@ -1093,6 +1093,7 @@
 	 * before being set, however, this loop will ALWAYS get executed
 	 * at least once, so freep is guaranteed to be set.
 	 */
+	freep = NULL;
 	first_page = hashp->hdr.last_freed >> (hashp->hdr.bshift + BYTE_SHIFT);
 	for (i = first_page; i <= free_page; i++) {
 		if (!(freep = fetch_bitmap(hashp, i)))

Modified: trunk/src/plugins/kdb/db2/libdb2/recno/rec_open.c
===================================================================
--- trunk/src/plugins/kdb/db2/libdb2/recno/rec_open.c	2011-09-05 01:21:55 UTC (rev 25146)
+++ trunk/src/plugins/kdb/db2/libdb2/recno/rec_open.c	2011-09-05 01:22:03 UTC (rev 25147)
@@ -65,7 +65,7 @@
 	DB *dbp;
 	PAGE *h;
 	struct stat sb;
-	int rfd, sverrno;
+	int rfd = -1, sverrno;
 
 	/* Open the user's file -- if this fails, we're done. */
 	if (fname != NULL && (rfd = open(fname, flags | O_BINARY, mode)) < 0)




More information about the cvs-krb5 mailing list