Subject: Unitiailised variables
To: None <tech-kern@netbsd.org>
From: Simon Burge <simonb@netbsd.org>
List: tech-kern
Date: 08/14/1999 22:51:03
I've just done a quick sweep through a GENERIC i386 kernel with
-Wuninitialized (wow, egcs on i386 generates quite a few false
positives compared with egcs on mips).  There's two which are
true positives but I'm not sure of the fix.

First:

	../../../../miscfs/umapfs/umap_vnops.c:
		In function `umap_lookup':
	../../../../miscfs/umapfs/umap_vnops.c:323:
		warning: `vp' might be used uninitialized in this function


In rev 1.15 it's declared on line 323 and then tested on line 376 without
being set.

Second:

	../../../../dev/pci/eso.c:
		In function `eso_freem':
	../../../../dev/pci/eso.c:1487:
		warning: `sc' might be used uninitialized in this function

A correct fix looks like:

Index: eso.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/pci/eso.c,v
retrieving revision 1.3
diff -p -u -r1.3 eso.c
--- eso.c	1999/08/02 17:37:43	1.3
+++ eso.c	1999/08/14 12:43:09
@@ -1484,7 +1484,7 @@ eso_freem(hdl, addr, type)
 	void *addr;
 	int type;
 {
-	struct eso_softc *sc;
+	struct eso_softc *sc = hdl;
 	struct eso_dma *p, **pp;
 
 	for (pp = &sc->sc_dmas; (p = *pp) != NULL; pp = &p->ed_next) {

but I'm not 100% sure.

Could someone in the know check out these two?

Simon.